Documentation
¶
Overview ¶
Package local provides a filesystem adapter contained within a local directory root.
Index ¶
- type Adapter
- func (a *Adapter) Capabilities() filesystem.CapabilitySet
- func (a *Adapter) Checksum(ctx context.Context, logicalPath filesystem.Path, ...) (filesystem.Checksum, error)
- func (a *Adapter) Close() error
- func (a *Adapter) Copy(ctx context.Context, source, destination filesystem.Path, ...) error
- func (a *Adapter) Delete(ctx context.Context, logicalPath filesystem.Path) error
- func (a *Adapter) List(ctx context.Context, directory filesystem.Path, options filesystem.ListOptions) (filesystem.EntryIterator, error)
- func (a *Adapter) Move(ctx context.Context, source, destination filesystem.Path, ...) error
- func (a *Adapter) Open(ctx context.Context, logicalPath filesystem.Path) (io.ReadCloser, error)
- func (a *Adapter) OpenRange(ctx context.Context, logicalPath filesystem.Path, ...) (io.ReadCloser, error)
- func (a *Adapter) OpenWriter(ctx context.Context, logicalPath filesystem.Path, ...) (io.WriteCloser, error)
- func (a *Adapter) SetMetadata(context.Context, filesystem.Path, map[string]string) error
- func (a *Adapter) SetVisibility(context.Context, filesystem.Path, filesystem.Visibility) error
- func (a *Adapter) Stat(ctx context.Context, logicalPath filesystem.Path) (filesystem.Metadata, error)
- func (a *Adapter) Visibility(context.Context, filesystem.Path) (filesystem.Visibility, error)
- func (a *Adapter) Write(ctx context.Context, logicalPath filesystem.Path, source io.Reader, ...) (filesystem.Metadata, error)
- type Option
- type SymlinkPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter accesses files through an os.Root, which prevents path traversal and symlink escape even when directory entries change concurrently.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() filesystem.CapabilitySet
Capabilities reports the adapter's explicitly supported operations.
func (*Adapter) Checksum ¶
func (a *Adapter) Checksum(ctx context.Context, logicalPath filesystem.Path, algorithm filesystem.ChecksumAlgorithm) (filesystem.Checksum, error)
Checksum streams a local file through an explicitly selected digest.
func (*Adapter) Copy ¶
func (a *Adapter) Copy(ctx context.Context, source, destination filesystem.Path, options filesystem.CopyOptions) error
Copy streams a source into an atomically published destination.
func (*Adapter) List ¶
func (a *Adapter) List(ctx context.Context, directory filesystem.Path, options filesystem.ListOptions) (filesystem.EntryIterator, error)
List walks a directory in deterministic order and stops at the configured limit rather than buffering an unbounded tree.
func (*Adapter) Move ¶
func (a *Adapter) Move(ctx context.Context, source, destination filesystem.Path, options filesystem.MoveOptions) error
Move renames a file atomically within the local root.
func (*Adapter) Open ¶
func (a *Adapter) Open(ctx context.Context, logicalPath filesystem.Path) (io.ReadCloser, error)
Open opens a file stream beneath the configured root.
func (*Adapter) OpenRange ¶
func (a *Adapter) OpenRange(ctx context.Context, logicalPath filesystem.Path, byteRange filesystem.ByteRange) (io.ReadCloser, error)
OpenRange opens a bounded file stream beneath the configured root.
func (*Adapter) OpenWriter ¶
func (a *Adapter) OpenWriter(ctx context.Context, logicalPath filesystem.Path, options filesystem.WriteOptions) (io.WriteCloser, error)
OpenWriter returns a streaming writer that atomically publishes its temporary file on Close.
func (*Adapter) SetMetadata ¶
SetMetadata returns a typed error because portable local user metadata is not supported.
func (*Adapter) SetVisibility ¶
func (a *Adapter) SetVisibility(context.Context, filesystem.Path, filesystem.Visibility) error
SetVisibility returns a typed unsupported error.
func (*Adapter) Stat ¶
func (a *Adapter) Stat(ctx context.Context, logicalPath filesystem.Path) (filesystem.Metadata, error)
Stat retrieves local file metadata.
func (*Adapter) Visibility ¶
func (a *Adapter) Visibility(context.Context, filesystem.Path) (filesystem.Visibility, error)
Visibility returns a typed unsupported error.
func (*Adapter) Write ¶
func (a *Adapter) Write(ctx context.Context, logicalPath filesystem.Path, source io.Reader, options filesystem.WriteOptions) (filesystem.Metadata, error)
Write atomically replaces a file after the source stream is fully persisted.
type Option ¶
type Option func(*config) error
Option configures an Adapter.
func WithDirectoryMode ¶
WithDirectoryMode sets the mode used for newly created directories.
func WithFileMode ¶
WithFileMode sets the mode used for newly written files.
func WithSymlinkPolicy ¶
func WithSymlinkPolicy(policy SymlinkPolicy) Option
WithSymlinkPolicy sets the explicit symbolic-link policy.
type SymlinkPolicy ¶
type SymlinkPolicy uint8
SymlinkPolicy controls whether logical paths may traverse symbolic links.
const ( // DenySymlinks rejects any symbolic-link path component. DenySymlinks SymlinkPolicy = iota // AllowInternalSymlinks permits links that remain beneath the opened root. AllowInternalSymlinks )