Documentation
¶
Overview ¶
Package arklocal implements ark.Backend on the local filesystem.
Objects live under <dir>/<namespace>/<name>, where the namespace is ark.HandleType.String(). Chunks are sharded two levels deep by the first four characters of their name: chunks/aa/bb/<name>.
Index ¶
- type Backend
- func (b *Backend) BasePath() string
- func (b *Backend) Close() error
- func (b *Backend) Delete(ctx context.Context, h ark.Handle) error
- func (b *Backend) Exists(ctx context.Context, h ark.Handle) (bool, error)
- func (b *Backend) Get(ctx context.Context, h ark.Handle) (io.ReadCloser, error)
- func (b *Backend) List(ctx context.Context, t ark.HandleType, fn func(ark.BlobInfo) error) error
- func (b *Backend) Put(ctx context.Context, h ark.Handle, r io.Reader) error
- func (b *Backend) Stat(ctx context.Context, h ark.Handle) (ark.BlobInfo, error)
- func (b *Backend) Sync(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements ark.Backend backed by a directory tree.
func New ¶
New creates or opens a local backend rooted at dir. The directory (and its parents) is created if it does not already exist.
func (*Backend) Delete ¶
Delete removes the object identified by h. A missing object is not an error. The removal becomes durable with the next Sync.
func (*Backend) List ¶
List walks the namespace of t and calls fn for every object it holds. An absent namespace is empty, not an error.
func (*Backend) Put ¶
Put writes r to a temporary file in the target directory and renames it into place, so a reader never sees a partial object. Nothing is flushed to disk: the object becomes durable with the next Sync.
func (*Backend) Sync ¶ added in v0.2.0
Sync flushes the filesystem holding the backend root, which makes every Put and Delete that returned before the call durable. On Linux that is syncfs on the root directory; when it fails for any reason, the global sync takes over, so Sync never skips the flush silently. On macOS it is the global sync from the start.