Documentation
¶
Overview ¶
Package store contains the sql backed store. It persists objects to a sqlite database.
Index ¶
- type Store
- func (s *Store) Add(obj any) error
- func (s *Store) Delete(obj any) error
- func (s *Store) DropAll(ctx context.Context) error
- func (s *Store) Get(obj any) (item any, exists bool, err error)
- func (s *Store) GetByKey(key string) (item any, exists bool, err error)
- func (s *Store) GetName() string
- func (s *Store) GetShouldEncrypt() bool
- func (s *Store) GetType() reflect.Type
- func (s *Store) List() []any
- func (s *Store) ListKeys() []string
- func (s *Store) RegisterAfterAdd(f func(key string, obj any, txC db.TxClient) error)
- func (s *Store) RegisterAfterDelete(f func(key string, obj any, txC db.TxClient) error)
- func (s *Store) RegisterAfterDeleteAll(f func(txC db.TxClient) error)
- func (s *Store) RegisterAfterUpdate(f func(key string, obj any, txC db.TxClient) error)
- func (s *Store) RegisterBeforeDropAll(f func(txC db.TxClient) error)
- func (s *Store) Replace(objects []any, _ string) error
- func (s *Store) Resync() error
- func (s *Store) Update(obj any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store is a SQLite-backed cache.Store
func NewStore ¶
func NewStore(ctx context.Context, example any, keyFunc cache.KeyFunc, c db.Client, shouldEncrypt bool, gvk schema.GroupVersionKind, name string, externalUpdateInfo *sqltypes.ExternalGVKUpdates, selfUpdateInfo *sqltypes.ExternalGVKUpdates) (*Store, error)
NewStore creates a SQLite-backed cache.Store for objects of the given example type
func (*Store) DropAll ¶ added in v0.6.40
DropAll effectively removes the store from the database. The store must be recreated with NewStore.
The store shouldn't be used once DropAll is called.
func (*Store) GetShouldEncrypt ¶
func (*Store) List ¶
List returns a list of all the currently known objects Note: I/O errors will panic this function, as the interface signature does not allow returning errors
func (*Store) ListKeys ¶
ListKeys returns a list of all the keys currently in this Store Note: Atm it doesn't appear returning nil in the case of an error has any detrimental effects. An error is not uncommon enough nor does it appear to necessitate a panic.
func (*Store) RegisterAfterAdd ¶ added in v0.6.7
RegisterAfterAdd registers a func to be called after each add event
func (*Store) RegisterAfterDelete ¶
RegisterAfterDelete registers a func to be called after each deletion
func (*Store) RegisterAfterDeleteAll ¶ added in v0.6.7
RegisterAfterDelete registers a func to be called after each deletion
func (*Store) RegisterAfterUpdate ¶ added in v0.6.7
RegisterAfterUpdate registers a func to be called after each update event