31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
|
|
"robotfs/pb"
|
|
"robotfs/utils"
|
|
)
|
|
|
|
type ListEachEntryFunc func(entry *pb.FileEntry) bool
|
|
|
|
type MetaStore interface {
|
|
GetName() string
|
|
|
|
Initialize(configuration utils.Configuration, prefix string) error
|
|
|
|
InsertEntry(context.Context, *pb.FileEntry) error
|
|
UpdateEntry(context.Context, *pb.FileEntry) (err error)
|
|
FindEntry(context.Context, utils.FullPath) (entry *pb.FileEntry, 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)
|
|
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()
|
|
}
|