You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.3 KiB

7 years ago
7 years ago
8 months ago
7 years ago
5 years ago
8 months ago
  1. package filer
  2. import (
  3. "context"
  4. "errors"
  5. "github.com/seaweedfs/seaweedfs/weed/util"
  6. "io"
  7. )
  8. const CountEntryChunksForGzip = 50
  9. var (
  10. ErrUnsupportedListDirectoryPrefixed = errors.New("unsupported directory prefix listing")
  11. ErrUnsupportedRecursivePrefixed = errors.New("unsupported recursive prefix listing")
  12. ErrUnsupportedSuperLargeDirectoryListing = errors.New("unsupported super large directory listing")
  13. ErrKvNotImplemented = errors.New("kv not implemented yet")
  14. ErrKvNotFound = errors.New("kv: not found")
  15. )
  16. type ListEachEntryFunc func(entry *Entry) bool
  17. type FilerStore interface {
  18. // GetName gets the name to locate the configuration in filer.toml file
  19. GetName() string
  20. // Initialize initializes the file store
  21. Initialize(configuration util.Configuration, prefix string) error
  22. InsertEntry(context.Context, *Entry) error
  23. UpdateEntry(context.Context, *Entry) (err error)
  24. // err == filer_pb.ErrNotFound if not found
  25. FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
  26. DeleteEntry(context.Context, util.FullPath) (err error)
  27. DeleteFolderChildren(context.Context, util.FullPath) (err error)
  28. ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
  29. ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
  30. ListRecursivePrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, delimiter bool, limit int64, prefix string, eachEntryFunc ListEachEntryFunc) (lastFileName string, err error)
  31. BeginTransaction(ctx context.Context) (context.Context, error)
  32. CommitTransaction(ctx context.Context) error
  33. RollbackTransaction(ctx context.Context) error
  34. KvPut(ctx context.Context, key []byte, value []byte) (err error)
  35. KvGet(ctx context.Context, key []byte) (value []byte, err error)
  36. KvDelete(ctx context.Context, key []byte) (err error)
  37. Shutdown()
  38. }
  39. type BucketAware interface {
  40. OnBucketCreation(bucket string)
  41. OnBucketDeletion(bucket string)
  42. CanDropWholeBucket() bool
  43. }
  44. type Debuggable interface {
  45. Debug(writer io.Writer)
  46. }