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.5 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. ErrKvNotImplemented = errors.New("kv not implemented yet")
  10. ErrKvNotFound = errors.New("kv: not found")
  11. )
  12. type FilerStore interface {
  13. // GetName gets the name to locate the configuration in filer.toml file
  14. GetName() string
  15. // Initialize initializes the file store
  16. Initialize(configuration util.Configuration, prefix string) error
  17. InsertEntry(context.Context, *Entry) error
  18. UpdateEntry(context.Context, *Entry) (err error)
  19. // err == filer_pb.ErrNotFound if not found
  20. FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
  21. DeleteEntry(context.Context, util.FullPath) (err error)
  22. DeleteFolderChildren(context.Context, util.FullPath) (err error)
  23. ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
  24. ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*Entry, error)
  25. BeginTransaction(ctx context.Context) (context.Context, error)
  26. CommitTransaction(ctx context.Context) error
  27. RollbackTransaction(ctx context.Context) error
  28. KvPut(ctx context.Context, key []byte, value []byte) (err error)
  29. KvGet(ctx context.Context, key []byte) (value []byte, err error)
  30. KvDelete(ctx context.Context, key []byte) (err error)
  31. Shutdown()
  32. }