pgkeyvalue

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

type KeyValue struct {
	Key      string    `db:"key"`
	Value    []byte    `db:"value"`
	Inserted time.Time `db:"inserted"`
}

type PGKeyValueStore

type PGKeyValueStore struct {
	// contains filtered or unexported fields
}

PGKeyValueStore is a time-limited key-value store backed by postgres with a local LRU cache. The store is write-only, i.e., writing to an existing key will return an error (of type *armadaerrors.ErrAlreadyExists). Keys can only be deleted by running the cleanup function. Deleting keys does not cause caches to update, i.e., nodes may have an inconsistent view if keys are deleted.

func New

func New(ctx *armadacontext.Context, db *pgxpool.Pool, tableName string) (*PGKeyValueStore, error)

func (*PGKeyValueStore) Load added in v0.3.89

func (c *PGKeyValueStore) Load(ctx *armadacontext.Context, keys []string) (map[string][]byte, error)

func (*PGKeyValueStore) PeriodicCleanup

func (c *PGKeyValueStore) PeriodicCleanup(ctx *armadacontext.Context, interval time.Duration, lifespan time.Duration) error

PeriodicCleanup starts a goroutine that automatically runs the cleanup job every interval until the provided context is cancelled.

func (*PGKeyValueStore) Store added in v0.3.89

func (c *PGKeyValueStore) Store(ctx *armadacontext.Context, kvs map[string][]byte) error

Jump to

Keyboard shortcuts

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