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.

39 lines
1.6 KiB

7 years ago
7 years ago
7 years ago
5 years ago
  1. package filer
  2. import (
  3. "context"
  4. "errors"
  5. "github.com/chrislusf/seaweedfs/weed/util"
  6. )
  7. var (
  8. ErrUnsupportedListDirectoryPrefixed = errors.New("unsupported directory prefix listing")
  9. ErrUnsupportedSuperLargeDirectoryListing = errors.New("unsupported super large directory listing")
  10. ErrKvNotImplemented = errors.New("kv not implemented yet")
  11. ErrKvNotFound = errors.New("kv: not found")
  12. )
  13. type FilerStore interface {
  14. // GetName gets the name to locate the configuration in filer.toml file
  15. GetName() string
  16. // Initialize initializes the file store
  17. Initialize(configuration util.Configuration, prefix string) error
  18. InsertEntry(context.Context, *Entry) error
  19. UpdateEntry(context.Context, *Entry) (err error)
  20. // err == filer_pb.ErrNotFound if not found
  21. FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
  22. DeleteEntry(context.Context, util.FullPath) (err error)
  23. DeleteFolderChildren(context.Context, util.FullPath) (err error)
  24. ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
  25. ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*Entry, error)
  26. BeginTransaction(ctx context.Context) (context.Context, error)
  27. CommitTransaction(ctx context.Context) error
  28. RollbackTransaction(ctx context.Context) error
  29. KvPut(ctx context.Context, key []byte, value []byte) (err error)
  30. KvGet(ctx context.Context, key []byte) (value []byte, err error)
  31. KvDelete(ctx context.Context, key []byte) (err error)
  32. Shutdown()
  33. }