Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { Exec(record TxRecord, handler TxHandler) (tx Tx, result any, err error) Migrate(statements []string) error }
Driver represents an underlying storage driver
type ReadTx ¶
type ReadTx interface { Select(out any, query string, args ...any) error Get(out any, query string, args ...any) error }
ReadTx is a read-only transaction
type ReadWriteTx ¶
ReadWriteTx is a transaction for read or write transactions
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a distributed, replicated datastore for libsdk applications
func New ¶
func New(driver Driver, replayer fabric.ReplayConnection) *Store
New creates a new Store with the given driver
func (*Store) Exec ¶
Exec performs a two-stage distributed transaction based on a registered named TxHandler. The Tx is distributed using the fabric and, upon confirmation of successful distribution, applied to the local store replica. The result or error of the TxHandler is returned. Non-errored call to Exec guarantees that replication succeeded.
type Tx ¶
type Tx interface { Read() ReadTx ReadWrite() ReadWriteTx DidWrite() bool }
Tx is an object that can itself kick off a read-only transaction or a read-write transaction which is managed by the underlying driver