filestore

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package filestore implements the blob.KV interface using files. The store comprises a directory with subdirectories keyed by a prefix of the encoded blob key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Opener

func Opener(ctx context.Context, addr string) (blob.KV, error)

Opener constructs a filestore from an address comprising a path, for use with the store package.

Types

type KV added in v0.7.0

type KV struct {
	// contains filtered or unexported fields
}

KV implements the [blob.kV] interface using a directory structure with one file per stored blob. Keys are encoded in hex and used to construct file and directory names relative to a root directory, similar to a Git local object store.

func (KV) Delete added in v0.7.0

func (s KV) Delete(_ context.Context, key string) error

Delete implements part of blob.KV.

func (KV) Dir added in v0.8.0

func (s KV) Dir() string

Dir reports the directory path associated with s.

func (KV) Get added in v0.7.0

func (s KV) Get(_ context.Context, key string) ([]byte, error)

Get implements part of blob.KV. It linearizes to the point at which opening the key path for reading returns.

func (KV) Len added in v0.7.0

func (s KV) Len(ctx context.Context) (int64, error)

Len implements part of blob.KV. It is implemented using List, so it linearizes in the same manner.

func (KV) List added in v0.7.0

func (s KV) List(_ context.Context, start string, f func(string) error) error

List implements part of blob.KV. If any concurrent Put operation on a key later than the current scan position succeeds, List linearizes immediately prior to the earliest such Put operation. Otherwise, List may be linearized to any point during its execution.

func (KV) Put added in v0.7.0

func (s KV) Put(_ context.Context, opts blob.PutOptions) error

Put implements part of blob.KV. A successful Put linearizes to the point at which the rename of the write temporary succeeds; a Put that fails due to an existing key linearizes to the point when the key path stat succeeds.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements the blob.Store interface using a directory structure with one file per stored blob. Keys are encoded in hex and used to construct the file and directory names relative to a root directory, similar to a Git local object store.

func New

func New(dir string) (Store, error)

New creates a Store associated with the specified root directory, which is created if it does not already exist.

func (Store) Close

func (Store) Close(context.Context) error

Close implements part of the blob.StoreCloser interface. This implementation always reports nil.

func (Store) Keyspace added in v0.8.0

func (s Store) Keyspace(_ context.Context, name string) (blob.KV, error)

Keyspace implements part of the blob.Store interface.

func (Store) Sub added in v0.8.0

func (s Store) Sub(_ context.Context, name string) (blob.Store, error)

Sub implements part of the blob.Store interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL