Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package store contains the sql backed store. It persists objects to a sqlite database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	db.Client
	// contains filtered or unexported fields
}

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) Add

func (s *Store) Add(obj any) error

Add saves an obj, or updates it if it exists in this Store

func (*Store) Bookmark added in v0.9.9

func (s *Store) Bookmark(resourceVersion string)

Bookmark implements the cache.Store interface.

func (*Store) Delete

func (s *Store) Delete(obj any) error

Delete deletes the given object, if it exists in this Store

func (*Store) DropAll added in v0.6.40

func (s *Store) DropAll(ctx context.Context) error

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) Get

func (s *Store) Get(obj any) (item any, exists bool, err error)

Get returns the object with the same key as obj

func (*Store) GetByKey

func (s *Store) GetByKey(key string) (item any, exists bool, err error)

GetByKey returns the object associated with the given object's key

func (*Store) GetName

func (s *Store) GetName() string

func (*Store) GetShouldEncrypt

func (s *Store) GetShouldEncrypt() bool

func (*Store) GetType

func (s *Store) GetType() reflect.Type

func (*Store) LastStoreSyncResourceVersion added in v0.9.9

func (s *Store) LastStoreSyncResourceVersion() string

LastStoreSyncResourceVersion implements cache.Store.

func (*Store) List

func (s *Store) List() []any

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

func (s *Store) ListKeys() []string

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

func (s *Store) RegisterAfterAdd(f func(key string, obj any, txC db.TxClient) error)

RegisterAfterAdd registers a func to be called after each add event

func (*Store) RegisterAfterDelete

func (s *Store) RegisterAfterDelete(f func(key string, obj any, txC db.TxClient) error)

RegisterAfterDelete registers a func to be called after each deletion

func (*Store) RegisterAfterDeleteAll added in v0.6.7

func (s *Store) RegisterAfterDeleteAll(f func(txC db.TxClient) error)

RegisterAfterDelete registers a func to be called after each deletion

func (*Store) RegisterAfterUpdate added in v0.6.7

func (s *Store) RegisterAfterUpdate(f func(key string, obj any, txC db.TxClient) error)

RegisterAfterUpdate registers a func to be called after each update event

func (*Store) RegisterBeforeDropAll added in v0.6.40

func (s *Store) RegisterBeforeDropAll(f func(txC db.TxClient) error)

func (*Store) Replace

func (s *Store) Replace(objects []any, resourceVersion string) error

Replace will delete the contents of the Store, using instead the given list

func (*Store) Resync

func (s *Store) Resync() error

Resync is a no-op and is deprecated

func (*Store) Update

func (s *Store) Update(obj any) error

Update saves an obj, or updates it if it exists in this Store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL