store.go 612 B

12345678910111213
  1. package keyvalue
  2. import "context"
  3. // Store holds arbitrary file data at the given 'path' location. Can be wrapped as a file system with keyvalue.NewFS().
  4. type Store interface {
  5. // Get retrieves a file record for the given 'path'.
  6. // Returns an error if the path was not found or could not be retrieved.
  7. // If the path was not found, the error must satisfy errors.Is(err, hackpadfs.ErrNotExist).
  8. Get(ctx context.Context, path string) (FileRecord, error)
  9. // Set assigns 'src' to the given 'path'. Returns an error if the data could not be set.
  10. Set(ctx context.Context, path string, src FileRecord) error
  11. }