Documentation
¶
Overview ¶
Package vfs provides a virtual filesystem abstraction over Trove object storage. It adapts flat object key spaces into hierarchical directory structures, enabling familiar file-system operations (Stat, ReadDir, Walk, Open, Create, Remove, Rename) and compatibility with Go's io/fs.FS interface.
Index ¶
- type DirEntry
- type FS
- func (f *FS) Create(ctx context.Context, name string) (*File, error)
- func (f *FS) GetMetadata(ctx context.Context, name string) (map[string]string, error)
- func (f *FS) Mkdir(ctx context.Context, name string) error
- func (f *FS) Open(ctx context.Context, name string) (*File, error)
- func (f *FS) ReadDir(ctx context.Context, name string) ([]DirEntry, error)
- func (f *FS) Remove(ctx context.Context, name string) error
- func (f *FS) RemoveAll(ctx context.Context, name string) error
- func (f *FS) Rename(ctx context.Context, oldName, newName string) error
- func (f *FS) SetMetadata(ctx context.Context, name string, meta map[string]string) error
- func (f *FS) Stat(ctx context.Context, name string) (*FileInfo, error)
- func (f *FS) Walk(ctx context.Context, root string, fn WalkFunc) error
- type File
- type FileInfo
- type IOFS
- type Storage
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry is a directory entry returned by ReadDir.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS provides a virtual filesystem over Trove object storage. Object keys are treated as file paths with "/" as the directory separator.
func (*FS) Create ¶
Create creates or overwrites a file. The caller must Close the returned File to flush the data to storage.
func (*FS) GetMetadata ¶
GetMetadata returns metadata for a file.
func (*FS) Mkdir ¶
Mkdir creates a directory marker object. This is a zero-length object with a trailing "/" in the key.
func (*FS) SetMetadata ¶
SetMetadata sets metadata on a file by copying it with updated metadata.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents an open VFS file backed by object storage.
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo implements os.FileInfo for VFS entries.
type IOFS ¶
type IOFS struct {
// contains filtered or unexported fields
}
IOFS adapts a Trove VFS to Go's io/fs.FS interface, enabling use with http.FileServer(http.FS(vfs)), template.ParseFS, and other stdlib consumers.
type Storage ¶
type Storage interface {
Put(ctx context.Context, bucket, key string, r io.Reader, opts ...driver.PutOption) (*driver.ObjectInfo, error)
Get(ctx context.Context, bucket, key string, opts ...driver.GetOption) (*driver.ObjectReader, error)
Delete(ctx context.Context, bucket, key string, opts ...driver.DeleteOption) error
Head(ctx context.Context, bucket, key string) (*driver.ObjectInfo, error)
List(ctx context.Context, bucket string, opts ...driver.ListOption) (*driver.ObjectIterator, error)
Copy(ctx context.Context, srcBucket, srcKey, dstBucket, dstKey string, opts ...driver.CopyOption) (*driver.ObjectInfo, error)
}
Storage defines the subset of Trove operations needed by VFS. This avoids a circular import with the trove package.