Documentation
¶
Overview ¶
Package affixed implements a blob.KV that delegates to another implementation, with keys namespaced by a fixed prefix and/or suffix concatenated with each key.
Index ¶
- type KV
- func (s KV) Base() blob.KV
- func (s KV) Delete(ctx context.Context, key string) error
- func (s KV) Derive(prefix, suffix string) KV
- func (s KV) Get(ctx context.Context, key string) ([]byte, error)
- func (s KV) Len(ctx context.Context) (int64, error)
- func (s KV) List(ctx context.Context, start string, f func(string) error) error
- func (s KV) Prefix() string
- func (s KV) Put(ctx context.Context, opts blob.PutOptions) error
- func (s KV) Suffix() string
- func (s KV) UnwrapKey(key string) string
- func (s KV) WithPrefix(prefix string) KV
- func (s KV) WithSuffix(suffix string) KV
- func (s KV) WrapKey(key string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KV ¶ added in v0.7.0
type KV struct {
// contains filtered or unexported fields
}
KV implements the blob.KV interface by delegating to an underlying keyspace, 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 KV.
func NewKV ¶ added in v0.9.0
NewKV creates a KV associated with the specified kv. The initial value is exactly equivalent to the underlying store; use Derive to create clones that use a different prefix/suffix.
Affixes do not nest: If s is already a KV, it is returned as-is.
func (KV) Derive ¶ added in v0.7.0
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 (KV) Len ¶ added in v0.7.0
Len implements part of blob.KV by delegation. It reports only the number of keys matching the current prefix.
func (KV) List ¶ added in v0.7.0
List implements part of blob.KV by delegation. It filters the underlying list results to include only keys prefixed/suffixed for this store.
func (KV) UnwrapKey ¶ added in v0.7.0
UnwrapKey returns the unwrapped version of key with the current prefix and suffix removed (if present).
func (KV) WithPrefix ¶ added in v0.7.0
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 (KV) WithSuffix ¶ added in v0.7.0
WithSuffix creates a clone of s that delegates to the same underlying store, but using a different suffix. The prefix, if any, is unchanged.