Documentation ¶
Overview ¶
Package affixed implements a blob.Store interface that delegates to another Store, with keys namespaced by a fixed prefix and/or suffix concatenated with each key.
Index ¶
- type CAS
- func (c CAS) Base() blob.CAS
- func (c CAS) CASKey(ctx context.Context, opts blob.CASPutOptions) (string, error)
- func (c CAS) CASPut(ctx context.Context, opts blob.CASPutOptions) (string, error)
- func (c CAS) Derive(prefix, suffix string) CAS
- func (c CAS) WithPrefix(prefix string) CAS
- func (c CAS) WithSuffix(suffix string) CAS
- type Store
- func (s Store) Base() blob.Store
- func (s Store) Close(ctx context.Context) error
- func (s Store) Delete(ctx context.Context, key string) error
- func (s Store) Derive(prefix, suffix string) Store
- func (s Store) Get(ctx context.Context, key string) ([]byte, error)
- func (s Store) Len(ctx context.Context) (int64, error)
- func (s Store) List(ctx context.Context, start string, f func(string) error) error
- func (s Store) Prefix() string
- func (s Store) Put(ctx context.Context, opts blob.PutOptions) error
- func (s Store) Suffix() string
- func (s Store) WithPrefix(prefix string) Store
- func (s Store) WithSuffix(suffix string) Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CAS ¶
type CAS struct { Store // contains filtered or unexported fields }
CAS implements a prefixed wrapper around a blob.CAS instance.
func NewCAS ¶
NewCAS creates a new prefixed Store associated with the specified cas. Prefixes do not nest: If cas is already a prefixed.CAS, it is returned as.is.
func (CAS) Derive ¶
Derive creates a clone of c that delegates to the same underlying store, but using a different prefix and suffix. If prefix == suffix == "", Derive returns a store that is equivalent to the original base store.
func (CAS) WithPrefix ¶
WithPrefix creates a clone of c that delegates to the same underlying store, but using a different prefix. The suffix, if any, is unchanged.
func (CAS) WithSuffix ¶
WithSuffix creates a clone of c that delegates to the same underlying store, but using a different suffix. The prefix, if any, is unchanged.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the blob.Store interface by delegating to an underlying store, but with each key prefixed and/or suffixed by fixed non-empty strings. This allows multiple consumers to share non-overlapping namespaces within a single storage backend.
func New ¶
New creates a Store associated with the specified s. The initial store is exactly equivalent to the underlying store; use Derive to create clones that use a different prefix.
Affixes do not nest: If s is already an affixed.Store, it is returned as-is.
func (Store) Close ¶
Close implements the optional blob.Closer interface. It delegates to the underlying store if possible.
func (Store) Derive ¶
Derive creates a clone of s that delegates to the same underlying store, but using a different prefix and suffix. If prefix == suffix == "", Derive returns a store that is equivalent to the original base store.
func (Store) Len ¶
Len implements part of blob.Store by delegation. It reports only the number of keys matching the current prefix.
func (Store) List ¶
List implements part of blob.Store by delegation. It filters the underlying list results to include only keys prefixed for this store.
func (Store) WithPrefix ¶
WithPrefix creates a clone of s that delegates to the same underlying store, but using a different prefix. The suffix, if any, is unchanged.
func (Store) WithSuffix ¶
WithSuffix creates a clone of s that delegates to the same underlying store, but using a different suffix. The prefix, if any, is unchanged.