Documentation
¶
Overview ¶
Package filestore is the local-filesystem drive object backend: the bundled default, zero infrastructure, directly inspectable.
A put is atomic: content is written to a temp file in the destination directory, then renamed into place, so a reader never observes a partial object and a failed put leaves nothing at the key. Keys are the ids the drive store mints — every segment must already be `[A-Za-z0-9._-]` and not only dots; this backend REJECTS anything else rather than sanitizing, because a key it did not expect is a bug, not input.
Index ¶
- type FileStore
- func (fs *FileStore) Copy(ctx context.Context, from, to string) error
- func (fs *FileStore) Delete(ctx context.Context, key string) error
- func (fs *FileStore) Get(ctx context.Context, key string) (io.ReadCloser, drive.ObjectInfo, error)
- func (fs *FileStore) List(ctx context.Context, prefix string, ...) error
- func (fs *FileStore) Name() string
- func (fs *FileStore) Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error
- func (fs *FileStore) Stat(ctx context.Context, key string) (drive.ObjectInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore implements drive.ObjectStore over a directory tree.
func New ¶
New returns a FileStore rooted at dir, creating dir (with parents) if absent. A failure here is a startup error, not a per-request one.
func (*FileStore) Copy ¶
Copy implements drive.ObjectCopier: a hard link when the filesystem allows it (the object is immutable, so sharing the inode is safe), else a byte copy.
func (*FileStore) Delete ¶
Delete implements drive.ObjectStore (idempotent). Empty parent directories are removed up to the root so a deleted resource leaves no trace.
func (*FileStore) Get ¶
func (fs *FileStore) Get(ctx context.Context, key string) (io.ReadCloser, drive.ObjectInfo, error)
Get implements drive.ObjectStore.
func (*FileStore) List ¶
func (fs *FileStore) List(ctx context.Context, prefix string, fn func(key string, info drive.ObjectInfo) error) error
List implements drive.ObjectStore: every regular file under prefix (a key prefix on segment boundaries; "" for all), skipping in-flight temp files.