Documentation ¶
Index ¶
- func ExistsUsingList[K any](ctx context.Context, s Lister[K], k K) (bool, error)
- func ForEach[K any](ctx context.Context, x Lister[K], span state.Span[K], fn func(K) error) error
- func Get[K, V any](ctx context.Context, x Getter[K, V], k K) (ret V, _ error)
- type Deleter
- type Entry
- type Exister
- type Getter
- type Lister
- type MemStore
- func (s *MemStore[K, V]) Delete(ctx context.Context, k K) error
- func (s *MemStore[K, V]) Exists(ctx context.Context, k K) (bool, error)
- func (s *MemStore[K, V]) Get(ctx context.Context, k K, dst *V) error
- func (s *MemStore[K, V]) Len() (count int)
- func (s *MemStore[K, V]) List(ctx context.Context, span state.Span[K], buf []K) (n int, err error)
- func (s *MemStore[K, V]) Modify(ctx context.Context, fn func(Store[K, V]) error) error
- func (s *MemStore[K, V]) Put(ctx context.Context, k K, v V) error
- func (s *MemStore[K, V]) View(ctx context.Context, fn func(ReadOnlyStore[K, V]) error) error
- type Poster
- type Putter
- type ReadOnlyStore
- type Store
- type StoreTx
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsUsingList ¶
ExistsUsingList implements Exists in terms of List
Types ¶
type Deleter ¶
type Deleter[K any] interface { // Delete removes the data at k Delete(ctx context.Context, k K) error }
Deleter has the Delete method
type Exister ¶
type Exister[K any] interface { // Exists returns true if the store contains an entry for k and false otherwise. Exists(ctx context.Context, k K) (bool, error) }
Exister has the Exists method
type Lister ¶
type Lister[K any] interface { // List copies keys from the store into the slice entries // and returns the number copied. // List signals the end of the list by returning (0, nil) // List may fill ks with fewer than len(ks), but will always return > 0, unless it is the end. // List will only return keys which are contained by in the span. List(ctx context.Context, span state.Span[K], ks []K) (int, error) }
Lister has the List method.
type MemStore ¶
type MemStore[K, V any] struct { // contains filtered or unexported fields }
func NewMemStore ¶
type Poster ¶
type Poster[K, V any] interface { // Post creates an entry holding v and returns a key for it. Post(ctx context.Context, v V) (K, error) }
Poster has the Post method
type Putter ¶
type Putter[K, V any] interface { // Put replaces data at key with value, or creates a mapping from k -> v // if it does not exist. Put(ctx context.Context, k K, v V) error }
Putter has the Put method
type ReadOnlyStore ¶
ReadOnlyStore is a KVStore which does not allow mutating data.
type StoreTx ¶
type StoreTx[K, V any] interface { // View calls fn with a ReadOnly view of the store View(ctx context.Context, fn func(tx ReadOnlyStore[K, V]) error) error // Modify calls fn with a mutable view of the store. // Any operations on the store are either all applied if fn and Modify both return nil, // or all reverted if either fn or View returns a non-nil error. Modify(ctx context.Context, fn func(tx Store[K, V]) error) error }
StoreTx is a transactional key value store
Click to show internal directories.
Click to hide internal directories.