Documentation
¶
Overview ¶
Package local implements a managed, crash-aware object store under an os.Root. Keys are independent of host filenames. Each published file atomically holds one binary header, complete metadata and payload; temporary files are hidden.
Index ¶
- Constants
- func Module(name foundation.ProviderID, key foundation.Key[*Backend], config Config) foundation.Module
- type Backend
- func (b *Backend) Capabilities() storage.Capabilities
- func (b *Backend) Close() error
- func (b *Backend) Copy(ctx context.Context, source, target storage.ObjectKey, ...) (storage.ObjectInfo, error)
- func (b *Backend) Delete(ctx context.Context, key storage.ObjectKey, options storage.DeleteOptions) (err error)
- func (b *Backend) List(ctx context.Context, options storage.ListOptions) (storage.Page, error)
- func (b *Backend) Locate(key storage.ObjectKey) (storage.ObjectAddress, error)
- func (b *Backend) Open(ctx context.Context, key storage.ObjectKey, options storage.ReadOptions) (io.ReadCloser, storage.ReadInfo, error)
- func (b *Backend) Prune(ctx context.Context, olderThan time.Time, limit int) (uint64, error)
- func (b *Backend) Put(ctx context.Context, key storage.ObjectKey, source io.Reader, ...) (storage.ObjectInfo, error)
- func (b *Backend) Start(ctx context.Context) error
- func (b *Backend) Stat(ctx context.Context, key storage.ObjectKey, options storage.ReadOptions) (storage.ObjectInfo, error)
- type Config
Constants ¶
const MaxPrune = 256
Variables ¶
This section is empty.
Functions ¶
func Module ¶
func Module(name foundation.ProviderID, key foundation.Key[*Backend], config Config) foundation.Module
Module prepares an adapter without I/O and opens its root during boot. Disk modules must require this provider so their readers drain before root cleanup.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func Prepare ¶
Prepare validates configuration without filesystem I/O. Start initializes or reopens the store during application boot; a closed backend cannot restart.
func (*Backend) Capabilities ¶
func (b *Backend) Capabilities() storage.Capabilities
func (*Backend) Copy ¶
func (b *Backend) Copy(ctx context.Context, source, target storage.ObjectKey, options storage.CopyOptions, maximum int64) (storage.ObjectInfo, error)
Copy implements storage.ServerCopier within one managed store. It writes a new record (the header binds its key) and copies the payload file-to-file, which uses kernel copy offload where the platform provides it, never the disk's streaming read path. The source is pinned by its validator and the destination publishes with the same condition checks as Put.
func (*Backend) List ¶
List scans the bounded store and keeps the smallest Limit+1 entries after the cursor. Unreadable or mismatched records are counted in Skipped rather than failing the page; staging and control files are never listed.
func (*Backend) Prune ¶
Prune removes only recognized, old staging files whose live-writer lock can be acquired. A slow upload is never removed merely because it is old. A crash releases its file lock. Published objects and marker/lock files are untouched. limit bounds deletion; Config.MaxScan independently bounds scanning work.
func (*Backend) Start ¶
Start takes ownership of an existing empty directory or reopens a previously initialized Foundry store. It never imports, wipes or overwrites an unrelated directory. The root must be controlled by trusted operators, not upload users. New files/directories use 0600/0700. Close all Disk operations before Close.