Documentation ¶
Overview ¶
Package kv provides a Key-Value Store interface and a few implementations.
Index ¶
- func KeyAfter(x []byte) []byte
- func PrefixEnd(prefix []byte) []byte
- func TestStore(t *testing.T, newStore func(t testing.TB) Store)
- type BucketStore
- func (s *BucketStore) Delete(ctx context.Context, key []byte) error
- func (s *BucketStore) Exists(ctx context.Context, key []byte) (bool, error)
- func (s *BucketStore) Get(ctx context.Context, key []byte, buf []byte) (int, error)
- func (s *BucketStore) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (s *BucketStore) Put(ctx context.Context, key []byte, value []byte) error
- type Deleter
- type FSStore
- func (s *FSStore) Delete(ctx context.Context, key []byte) error
- func (s *FSStore) Exists(ctx context.Context, key []byte) (bool, error)
- func (s *FSStore) Get(ctx context.Context, key, buf []byte) (_ int, retErr error)
- func (s *FSStore) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (s *FSStore) Put(ctx context.Context, key, value []byte) (retErr error)
- type GetPut
- type Getter
- type KeyIterable
- type LRUCache
- func (c *LRUCache) Delete(ctx context.Context, key []byte) error
- func (c *LRUCache) Exists(ctx context.Context, key []byte) (bool, error)
- func (c *LRUCache) Get(ctx context.Context, key []byte, buf []byte) (int, error)
- func (c *LRUCache) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (c *LRUCache) Put(ctx context.Context, key, value []byte) error
- type MemStore
- func (ms *MemStore) Delete(ctx context.Context, key []byte) error
- func (ms *MemStore) Exists(ctx context.Context, key []byte) (bool, error)
- func (ms *MemStore) Get(ctx context.Context, key []byte, buf []byte) (int, error)
- func (ms *MemStore) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (ms *MemStore) Put(ctx context.Context, key, value []byte) error
- type Pool
- type Prefixed
- func (s *Prefixed) Delete(ctx context.Context, key []byte) error
- func (s *Prefixed) Exists(ctx context.Context, key []byte) (bool, error)
- func (s *Prefixed) Get(ctx context.Context, key []byte, buf []byte) (int, error)
- func (s *Prefixed) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (s *Prefixed) Put(ctx context.Context, key []byte, value []byte) error
- type Putter
- type Semaphored
- func (s *Semaphored) Delete(ctx context.Context, key []byte) error
- func (s *Semaphored) Exists(ctx context.Context, key []byte) (bool, error)
- func (s *Semaphored) Get(ctx context.Context, key, buf []byte) (int, error)
- func (sem *Semaphored) NewKeyIterator(span Span) stream.Iterator[[]byte]
- func (s *Semaphored) Put(ctx context.Context, key, value []byte) error
- type Span
- type Store
- type ValueCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyAfter ¶ added in v2.7.0
KeyAfter returns a byte slice ordered immediately after x lexicographically the motivating use case is iteration.
Types ¶
type BucketStore ¶ added in v2.7.0
type BucketStore struct {
// contains filtered or unexported fields
}
func NewFromBucket ¶ added in v2.7.0
func NewFromBucket(b *blob.Bucket, maxKeySize, maxValueSize int) *BucketStore
func (*BucketStore) Delete ¶ added in v2.7.0
func (s *BucketStore) Delete(ctx context.Context, key []byte) error
func (*BucketStore) NewKeyIterator ¶ added in v2.7.0
func (s *BucketStore) NewKeyIterator(span Span) stream.Iterator[[]byte]
type FSStore ¶ added in v2.7.0
type FSStore struct {
// contains filtered or unexported fields
}
func NewFSStore ¶ added in v2.7.0
func (*FSStore) NewKeyIterator ¶ added in v2.7.0
type KeyIterable ¶ added in v2.7.0
type LRUCache ¶ added in v2.7.0
type LRUCache struct {
// contains filtered or unexported fields
}
func NewLRUCache ¶ added in v2.7.0
func (*LRUCache) NewKeyIterator ¶ added in v2.7.0
type MemStore ¶ added in v2.7.0
type MemStore struct {
// contains filtered or unexported fields
}
MemStore implements an in-memory store
func NewMemStore ¶ added in v2.7.0
func NewMemStore() *MemStore
func (*MemStore) NewKeyIterator ¶ added in v2.7.0
type Pool ¶ added in v2.7.0
type Pool struct {
// contains filtered or unexported fields
}
Pool manages a pool of buffers, all the same size.
The pointer to slice stuff is to make the linter happy.
type Prefixed ¶ added in v2.7.0
type Prefixed struct {
// contains filtered or unexported fields
}
Prefixed is a Store whichs stores entries beneath a prefix in a backing Store.
func NewPrefixed ¶ added in v2.7.0
func (*Prefixed) NewKeyIterator ¶ added in v2.7.0
type Semaphored ¶ added in v2.7.0
type Semaphored struct {
// contains filtered or unexported fields
}
func NewSemaphored ¶ added in v2.7.0
func NewSemaphored(inner Store, download, upload int) *Semaphored
func (*Semaphored) Delete ¶ added in v2.7.0
func (s *Semaphored) Delete(ctx context.Context, key []byte) error
func (*Semaphored) NewKeyIterator ¶ added in v2.7.0
func (sem *Semaphored) NewKeyIterator(span Span) stream.Iterator[[]byte]
type Span ¶ added in v2.7.0
Span is a range of bytes from Begin inclusive to End exclusive As a special case if End == nil, then the span has no upper bound.
func SpanFromPrefix ¶ added in v2.7.0
type Store ¶
type Store interface { Getter Putter Deleter Exists(ctx context.Context, key []byte) (bool, error) KeyIterable }
Store is a key-value store
type ValueCallback ¶
ValueCallback is the type of functions used to access values It is never ok for the callback to retain the data. If it were ok, then the callee would just return the data.