Documentation ¶
Overview ¶
Package memorystorev2 contains an implementation for a transactional memory store suitable for the FDv2 architecture.
Index ¶
- type Store
- func (s *Store) ApplyDelta(allData []ldstoretypes.Collection) map[ldstoretypes.DataKind]map[string]bool
- func (s *Store) Get(kind ldstoretypes.DataKind, key string) (ldstoretypes.ItemDescriptor, error)
- func (s *Store) GetAll(kind ldstoretypes.DataKind) ([]ldstoretypes.KeyedItemDescriptor, error)
- func (s *Store) GetAllKinds() []ldstoretypes.Collection
- func (s *Store) IsInitialized() bool
- func (s *Store) SetBasis(allData []ldstoretypes.Collection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store provides an abstraction that makes flag and segment data available to other components. It accepts updates in batches - for instance, flag A was upserted while segment B was deleted - such that the contents of the store are consistent with a single payload version at any given time.
The terminology used is "basis" and "deltas". First, the store's basis is set. This is this initial data, upon which subsequent deltas will be applied. Whenever the basis is set, any existing data is discarded.
Deltas are then applied to the store. A single delta update transforms the contents of the store atomically.
func (*Store) ApplyDelta ¶
func (s *Store) ApplyDelta(allData []ldstoretypes.Collection) map[ldstoretypes.DataKind]map[string]bool
ApplyDelta applies a delta update to the store. ApplyDelta should not be called until SetBasis has been called at least once. The return value indicates, for each DataKind present in the delta, whether the item in the delta was actually updated or not.
An item is updated only if the version of the item in the delta is greater than the version in the store, or it wasn't already present.
func (*Store) Get ¶
func (s *Store) Get(kind ldstoretypes.DataKind, key string) (ldstoretypes.ItemDescriptor, error)
Get retrieves an item of the specified kind from the store. If the item is not found, then ItemDescriptor{}.NotFound() is returned with a nil error.
func (*Store) GetAll ¶
func (s *Store) GetAll(kind ldstoretypes.DataKind) ([]ldstoretypes.KeyedItemDescriptor, error)
GetAll retrieves all items of the specified kind from the store.
func (*Store) GetAllKinds ¶
func (s *Store) GetAllKinds() []ldstoretypes.Collection
GetAllKinds retrieves all items of all kinds from the store. This is different from calling GetAll for each kind because it provides a consistent view of the entire store at a single point in time.
func (*Store) IsInitialized ¶
IsInitialized returns true if the store has ever been initialized with a basis.
func (*Store) SetBasis ¶
func (s *Store) SetBasis(allData []ldstoretypes.Collection)
SetBasis sets the basis of the Store. Any existing data is discarded. When the basis is set, the store becomes initialized.