39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package meta
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"robotfs/config"
|
|
"robotfs/utils"
|
|
)
|
|
|
|
var (
|
|
ErrUnsupportedListDirectoryPrefixed = errors.New("unsupported directory prefix listing")
|
|
ErrKvNotImplemented = errors.New("kv not implemented yet")
|
|
ErrKvNotFound = errors.New("kv: not found")
|
|
)
|
|
|
|
type ListEachEntryFunc func(entry *utils.Entry) bool
|
|
|
|
type MetaStore interface {
|
|
GetName() string
|
|
|
|
Initialize(configuration config.Configuration, prefix string) error
|
|
|
|
InsertEntry(context.Context, *utils.Entry) error
|
|
UpdateEntry(context.Context, *utils.Entry) (err error)
|
|
FindEntry(context.Context, utils.FullPath) (entry *utils.Entry, err error)
|
|
DeleteEntry(context.Context, utils.FullPath) (err error)
|
|
DeleteFolderChildren(context.Context, utils.FullPath) (err error)
|
|
ListDirectoryEntries(ctx context.Context, dirPath utils.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
|
|
// Todo: implement this in the future
|
|
ListDirectoryPrefixedEntries(ctx context.Context, dirPath utils.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
|
|
|
|
BeginTransaction(ctx context.Context) (context.Context, error)
|
|
CommitTransaction(ctx context.Context) error
|
|
RollbackTransaction(ctx context.Context) error
|
|
|
|
Shutdown()
|
|
}
|