seaweedfs/weed/filer/filerstore.go

48 lines
1.9 KiB
Go
Raw Normal View History

2020-09-01 07:21:19 +00:00
package filer
2018-05-26 06:27:06 +00:00
import (
2019-03-15 22:55:34 +00:00
"context"
"errors"
"github.com/chrislusf/seaweedfs/weed/util"
)
2018-05-26 06:27:06 +00:00
var (
ErrUnsupportedListDirectoryPrefixed = errors.New("unsupported directory prefix listing")
ErrUnsupportedSuperLargeDirectoryListing = errors.New("unsupported super large directory listing")
ErrKvNotImplemented = errors.New("kv not implemented yet")
ErrKvNotFound = errors.New("kv: not found")
)
2021-01-16 07:56:24 +00:00
type ListEachEntryFunc func(entry *Entry) bool
2018-05-26 06:27:06 +00:00
type FilerStore interface {
// GetName gets the name to locate the configuration in filer.toml file
GetName() string
2018-06-17 20:01:57 +00:00
// Initialize initializes the file store
Initialize(configuration util.Configuration, prefix string) error
2019-03-15 22:55:34 +00:00
InsertEntry(context.Context, *Entry) error
UpdateEntry(context.Context, *Entry) (err error)
2020-09-24 10:06:44 +00:00
// err == filer_pb.ErrNotFound if not found
2020-03-23 07:01:34 +00:00
FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
DeleteEntry(context.Context, util.FullPath) (err error)
DeleteFolderChildren(context.Context, util.FullPath, int64) (err error)
2021-01-16 07:56:24 +00:00
ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.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
2020-03-15 03:30:26 +00:00
KvPut(ctx context.Context, key []byte, value []byte) (err error)
KvGet(ctx context.Context, key []byte) (value []byte, err error)
KvDelete(ctx context.Context, key []byte) (err error)
2020-03-15 03:30:26 +00:00
Shutdown()
}
type BucketAware interface {
OnBucketCreation(bucket string)
OnBucketDeletion(bucket string)
CanDropWholeBucket() bool
}