Documentation
¶
Overview ¶
Package file implements the provider interface for local filesystem paths.
Library consumers can use Config and New directly when they need a local provider for tests, examples, or transfer workflows. Config is an explicit per-instance value; the package does not read gonimbus CLI configuration or GONIMBUS_* environment variables as part of provider construction.
IfAbsent publication and reserved staging names ¶
Conditional IfAbsent puts stage the complete body under the destination directory with CreateTemp pattern "gonimbus-ifabsent-*.tmp", then publish with os.Link (atomic no-replace). The final object key is never opened for streaming under O_EXCL, so a hard interrupt mid-write cannot leave a visible partial final. Plain os.Rename is not used for IfAbsent (replace semantics).
List omits only basenames that match the reserved staging shape gonimbus-ifabsent-<nonce>.tmp (non-empty nonce without '.' or path separators). Ordinary object keys that merely contain the token "gonimbus-ifabsent" (for example gonimbus-ifabsent-report.csv) remain listable. Callers must not rely on that reserved basename shape as a durable user key.
See docs/library-consumers.md for the embedded-use contract shared by the supported library packages.
API stability: Stable. Breaking changes to exported symbols or documented behavior follow the Library API protocol in docs/api-stability.md.
Index ¶
- Constants
- type Config
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) ConditionalWriteCapabilities() provider.ConditionalWriteCapabilities
- func (p *Provider) DeleteObject(ctx context.Context, key string) error
- func (p *Provider) GetObject(ctx context.Context, key string) (io.ReadCloser, int64, error)
- func (p *Provider) GetObjectRevision(ctx context.Context, key string, revision provider.SourceRevision) (io.ReadCloser, provider.ObjectMeta, error)
- func (p *Provider) GetObjectVersioned(ctx context.Context, key string) (io.ReadCloser, provider.ObjectMeta, error)
- func (p *Provider) GetRange(ctx context.Context, key string, start, endInclusive int64) (io.ReadCloser, int64, error)
- func (p *Provider) Head(ctx context.Context, key string) (*provider.ObjectMeta, error)
- func (p *Provider) List(ctx context.Context, opts provider.ListOptions) (*provider.ListResult, error)
- func (p *Provider) PutObject(ctx context.Context, key string, body io.Reader, contentLength int64) error
- func (p *Provider) PutObjectConditional(ctx context.Context, key string, body io.Reader, contentLength int64, ...) (provider.PutResult, error)
- func (p *Provider) PutObjectConditionalWithOptions(ctx context.Context, key string, body io.Reader, contentLength int64, ...) (provider.PutResult, error)
- func (p *Provider) PutObjectWithOptions(ctx context.Context, key string, body io.Reader, contentLength int64, ...) error
Constants ¶
const ( DefaultMetadataSidecarSuffix = ".gnb-meta.json" SymlinkPolicySkip = "skip" SymlinkPolicyFollow = "follow" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements provider.Provider for local filesystem paths.
Keys are treated as relative paths under BaseDir.
This provider is intended for bucket-to-local transfer workflows.
func (*Provider) ConditionalWriteCapabilities ¶
func (p *Provider) ConditionalWriteCapabilities() provider.ConditionalWriteCapabilities
ConditionalWriteCapabilities declares the conditional-write predicates this file adapter honors: IfAbsent (same-dir temp + no-replace Link publish) and IfMatch (lock + ETag compare-and-swap). The file provider has no multipart path, so conditional multipart completion is not offered.
func (*Provider) DeleteObject ¶
func (*Provider) GetObjectRevision ¶
func (p *Provider) GetObjectRevision(ctx context.Context, key string, revision provider.SourceRevision) (io.ReadCloser, provider.ObjectMeta, error)
GetObjectRevision opens the file and refuses if its admitted local revision token no longer matches the opened file.
func (*Provider) GetObjectVersioned ¶
func (p *Provider) GetObjectVersioned(ctx context.Context, key string) (io.ReadCloser, provider.ObjectMeta, error)
func (*Provider) List ¶
func (p *Provider) List(ctx context.Context, opts provider.ListOptions) (*provider.ListResult, error)