Documentation
¶
Overview ¶
Package file provides a local filesystem backend for omnistorage.
Index ¶
- func NewFromConfig(configMap map[string]string) (omnistorage.Backend, error)
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Copy(ctx context.Context, src, dst string) error
- func (b *Backend) Delete(ctx context.Context, path string) error
- func (b *Backend) Exists(ctx context.Context, path string) (bool, error)
- func (b *Backend) Features() omnistorage.Features
- func (b *Backend) List(ctx context.Context, prefix string) ([]string, error)
- func (b *Backend) Mkdir(ctx context.Context, path string) error
- func (b *Backend) Move(ctx context.Context, src, dst string) error
- func (b *Backend) NewReader(ctx context.Context, path string, opts ...omnistorage.ReaderOption) (io.ReadCloser, error)
- func (b *Backend) NewWriter(ctx context.Context, path string, opts ...omnistorage.WriterOption) (io.WriteCloser, error)
- func (b *Backend) Rmdir(ctx context.Context, path string) error
- func (b *Backend) Stat(ctx context.Context, path string) (omnistorage.ObjectInfo, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromConfig ¶
func NewFromConfig(configMap map[string]string) (omnistorage.Backend, error)
NewFromConfig creates a new file backend from a config map. Supported keys:
- root: root directory (default: ".")
- create_dirs: "true" or "false" (default: "true")
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements omnistorage.Backend for local filesystem.
func (*Backend) Copy ¶
Copy copies an object from src to dst using server-side copy (hard link or copy).
func (*Backend) Features ¶
func (b *Backend) Features() omnistorage.Features
Features returns the capabilities of the file backend.
func (*Backend) NewReader ¶
func (b *Backend) NewReader(ctx context.Context, path string, opts ...omnistorage.ReaderOption) (io.ReadCloser, error)
NewReader creates a reader for the given path.
func (*Backend) NewWriter ¶
func (b *Backend) NewWriter(ctx context.Context, path string, opts ...omnistorage.WriterOption) (io.WriteCloser, error)
NewWriter creates a writer for the given path.
func (*Backend) Stat ¶
func (b *Backend) Stat(ctx context.Context, path string) (omnistorage.ObjectInfo, error)
Stat returns metadata about an object at the given path.
type Config ¶
type Config struct {
// Root is the root directory for all operations.
// All paths are relative to this directory.
Root string
// CreateDirs controls whether parent directories are created automatically.
// Default: true
CreateDirs bool
// DirPermissions is the permission mode for created directories.
// Default: 0755
DirPermissions os.FileMode
// FilePermissions is the permission mode for created files.
// Default: 0644
FilePermissions os.FileMode
}
Config holds configuration for the file backend.
Click to show internal directories.
Click to hide internal directories.