Documentation
¶
Index ¶
- Variables
- type AuditInfoStore
- type BindingStore
- type ColumnKey
- type Config
- type Driver
- type KeyValueStore
- type NamedDriver
- type Notifier
- type Operation
- type PersistenceConfig
- type PersistenceName
- type QueryExecutor
- type SQLError
- type SQLErrorWrapper
- type SignerInfoStore
- type TriggerCallback
- type UnversionedNotifier
- type UnversionedRead
- type UnversionedValue
- type UnversionedWriteTransaction
- type VersionedPersistence
Constants ¶
This section is empty.
Variables ¶
var ( // UniqueKeyViolation happens when we try to insert a record with a conflicting unique key (e.g. replicas) UniqueKeyViolation = errors.New("unique key violation") // DeadlockDetected happens when two transactions are taking place at the same time and interact with the same rows DeadlockDetected = errors.New("deadlock detected") // SqlBusy happens when two transactions are trying to write at the same time. Can be avoided by opening the database in exclusive mode SqlBusy = errors.New("sql is busy") )
Functions ¶
This section is empty.
Types ¶
type AuditInfoStore ¶
type AuditInfoStore = driver.AuditInfoStore
type BindingStore ¶
type BindingStore = driver.BindingStore
type Config ¶
type Config interface {
// IsSet checks to see if the key has been set in any of the data locations
IsSet(key string) bool
// UnmarshalKey takes the value corresponding to the passed key and unmarshals it into the passed structure
UnmarshalKey(key string, rawVal interface{}) error
}
Config provides access to the underlying configuration
type Driver ¶
type Driver interface {
// NewKVS returns a new KeyValueStore for the passed data source and config
NewKVS(PersistenceName, ...string) (KeyValueStore, error)
// NewBinding returns a new BindingStore for the passed data source and config
NewBinding(PersistenceName, ...string) (BindingStore, error)
// NewSignerInfo returns a new SignerInfoStore for the passed data source and config
NewSignerInfo(PersistenceName, ...string) (SignerInfoStore, error)
// NewAuditInfo returns a new AuditInfoStore for the passed data source and config
NewAuditInfo(PersistenceName, ...string) (AuditInfoStore, error)
}
type KeyValueStore ¶
type KeyValueStore interface {
// SetState sets the given value for the given namespace, key, and version
SetState(ctx context.Context, namespace driver.Namespace, key driver.PKey, value driver.UnversionedValue) error
// SetStates sets the given values for the given namespace, key, and version
SetStates(ctx context.Context, namespace driver.Namespace, kvs map[driver.PKey]driver.UnversionedValue) map[driver.PKey]error
// GetState gets the value and version for given namespace and key
GetState(ctx context.Context, namespace driver.Namespace, key driver.PKey) (driver.UnversionedValue, error)
// DeleteState deletes the given namespace and key
DeleteState(ctx context.Context, namespace driver.Namespace, key driver.PKey) error
// DeleteStates deletes the given namespace and keys
DeleteStates(ctx context.Context, namespace driver.Namespace, keys ...driver.PKey) map[driver.PKey]error
// GetStateRangeScanIterator returns an iterator that contains all the key-values between given key ranges.
// startKey is included in the results and endKey is excluded. An empty startKey refers to the first available key
// and an empty endKey refers to the last available key. For scanning all the keys, both the startKey and the endKey
// can be supplied as empty strings. However, a full scan should be used judiciously for performance reasons.
GetStateRangeScanIterator(ctx context.Context, namespace driver.Namespace, startKey, endKey driver.PKey) (iterators.Iterator[*driver.UnversionedRead], error)
// GetStateSetIterator returns an iterator that contains all the values for the passed keys.
// The order is not respected.
GetStateSetIterator(ctx context.Context, ns driver.Namespace, keys ...driver.PKey) (iterators.Iterator[*driver.UnversionedRead], error)
// Close closes this persistence instance
Close() error
// BeginUpdate starts the session
BeginUpdate() error
// Commit commits the changes since BeginUpdate
Commit() error
// Discard discards the changes since BeginUpdate
Discard() error
// Stats returns driver specific statistics of the datastore
Stats() any
}
KeyValueStore models a key-value storage place
type NamedDriver ¶
type NamedDriver = driver.NamedDriver[Driver]
type Notifier ¶
type Notifier interface {
// Subscribe registers a listener for when a value is inserted/updated/deleted in the given table
Subscribe(callback TriggerCallback) error
// UnsubscribeAll removes all registered listeners for the given table
UnsubscribeAll() error
}
type PersistenceConfig ¶
type PersistenceConfig interface {
// GetDriverType returns the persistence type (memory, postgres, sqlite) of a specific persistence config
// Corresponds to fsc.persistences.{{persistence_name}}.type
GetDriverType(PersistenceName) (driver.PersistenceType, error)
// UnmarshalDriverOpts retrieves the persistence options of a specific persistence config
// The actual options may vary depending on the persistence type
// Corresponds to fsc.persistences.{{persistence_name}}.opts
UnmarshalDriverOpts(name PersistenceName, v any) error
}
PersistenceConfig reads the section under fsc.persistences in the core.yaml
type PersistenceName ¶
type PersistenceName string
PersistenceName is the key of a persistence configuration in the core.yaml under fsc.persistences Each store has a property "persistence" that references to a persistence config by its name If the persistence property is not populated, the "default" persistence name is implied (if this is defined under fsc.persistences).
type QueryExecutor ¶
type QueryExecutor = driver.QueryExecutor
type SQLErrorWrapper ¶
SQLErrorWrapper transforms the different errors returned by various SQL implementations into an SQLError that is common
type SignerInfoStore ¶
type SignerInfoStore = driver.SignerInfoStore
type TriggerCallback ¶
type UnversionedNotifier ¶
type UnversionedNotifier interface {
KeyValueStore
Notifier
}
type UnversionedRead ¶
type UnversionedRead = driver.UnversionedRead
type UnversionedValue ¶
type UnversionedValue = driver.UnversionedValue
type UnversionedWriteTransaction ¶
type UnversionedWriteTransaction interface {
// SetState sets the given value for the given namespace, key
SetState(namespace driver.Namespace, key driver.PKey, value UnversionedValue) error
// DeleteState deletes the given namespace and key
DeleteState(namespace driver.Namespace, key driver.PKey) error
// Commit commits the changes since BeginUpdate
Commit() error
// Discard discards the changes since BeginUpdate
Discard() error
}
type VersionedPersistence ¶
type VersionedPersistence = KeyValueStore
VersionedPersistence models a versioned key-value storage place
Directories
¶
| Path | Synopsis |
|---|---|
|
mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
query/common/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |