type CommitStamp uint64 A transaction groups reads and writes across collections and modalities, and commits all of them or none.
Its own verbs record the keys they touch, so the commit reports StatusWriteConflict, StatusReadConflict or StatusPhantomConflict if another writer changed them, while Transaction.View with WatchNone records nothing.
A transaction conflicts rather than blocks, and keeps its contents whatever the outcome, so Reset reopens it on the newest state for another try. Stage answers a ReadStamp, the stamp the transaction reads at and its commit validates against, and Commit a CommitStamp, its position in commit order; the two are distinct types, so neither is compared with the other by accident. Rollback withdraws a stage while keeping the reads and writes, so the transaction can stage again.
transaction, err := database.TransactionInit()
defer transaction.Close()
err = transaction.BlobsWrite(people, []ustore.Key{ada, grace}, ustore.TapeOf("Ada", "Grace"), nil)
peek, err := transaction.View(ustore.WatchNone).BlobsRead(people, []ustore.Key{ada}, arena, nil)
readStamp, err := transaction.Stage()
commitStamp, err := transaction.Commit(ustore.DurabilityFlushed)API
Types
CommitStampCommitStamp is a commit's position in commit order, which a read at any ReadStamp at or above it sees.
ReadStampReadStamp is the stamp a transaction or a snapshot reads at.
type ReadStamp uint64 EnumIsolationIsolation is how the transactions of the in-memory engine see each other's writes.2
type Isolation int32 Values
IsolationStrictSerializable | IsolationStrictSerializable makes every transaction appear to run alone at one moment. | |
|---|---|---|
IsolationSnapshot | IsolationSnapshot makes every transaction read the state its start saw. |
IsolationFromNameIsolationFromName reads an isolation back from the spelling Isolation.String renders.
func IsolationFromName(name string) (Isolation, error) StringString renders the isolation as the library spells it.
func (isolation Isolation) String() string StructTransactionDeferredOnTransactionDeferredOn is the receiver whose verbs submit their calls to an executor, offering the verbs of TransactionOn with the same arguments.18
type TransactionDeferredOn struct {
// contains filtered or unexported fields
} *× 3Commit submits TransactionOn.Commit.
func (on TransactionDeferredOn) Commit(
durability Durability,
) (*Deferred[CommitStamp], error) | Symbol |
|---|
Commit |
Rollback |
Stage |
BlobsRemoveBlobsRemove submits DatabaseOn.BlobsRemove.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) BlobsRemove(
collections Collections,
keys []Key,
config *RemoveConfig,
) (*Deferred[struct{}], error) BlobsWriteBlobsWrite submits DatabaseOn.BlobsWrite.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) BlobsWrite(
collections Collections,
keys []Key,
values Tape,
config *WriteConfig,
) (*Deferred[struct{}], error) DocsRemoveDocsRemove submits DatabaseOn.DocsRemove.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) DocsRemove(
collections Collections,
keys []Key,
config *RemoveConfig,
) (*Deferred[struct{}], error) DocsWriteDocsWrite submits DatabaseOn.DocsWrite.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) DocsWrite(
collections Collections,
keys []Key,
values Tape,
config *DocsWriteConfig,
) (*Deferred[struct{}], error) GraphRemoveEdgesGraphRemoveEdges submits DatabaseOn.GraphRemoveEdges.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) GraphRemoveEdges(
collections Collections,
edges []Edge,
config *WriteConfig,
) (*Deferred[struct{}], error) GraphRemoveVerticesGraphRemoveVertices submits DatabaseOn.GraphRemoveVertices.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) GraphRemoveVertices(
collections Collections,
vertices []Key,
config *GraphRemoveVerticesConfig,
) (*Deferred[struct{}], error) GraphWriteEdgesGraphWriteEdges submits DatabaseOn.GraphWriteEdges.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) GraphWriteEdges(
collections Collections,
edges []Edge,
config *WriteConfig,
) (*Deferred[struct{}], error) GraphWriteVerticesGraphWriteVertices submits DatabaseOn.GraphWriteVertices.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) GraphWriteVertices(
collections Collections,
vertices []Key,
config *WriteConfig,
) (*Deferred[struct{}], error) PagesImportPagesImport submits DatabaseOn.PagesImport.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesImport(
collections Collections,
keys []Key,
values Tape,
config *PagesImportConfig,
) (*Deferred[struct{}], error) PagesInsertPagesInsert submits DatabaseOn.PagesInsert.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesInsert(
collections Collections,
keys []Key,
values Tape,
arena *Arena,
config *PagesInsertConfig,
) (*Deferred[Inserted], error) PagesMovePagesMove submits DatabaseOn.PagesMove.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesMove(
collections Collections,
keys, elements []Key,
config *PagesMoveConfig,
) (*Deferred[struct{}], error) PagesRemovePagesRemove submits DatabaseOn.PagesRemove.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesRemove(
collections Collections,
keys []Key,
config *PagesRemoveConfig,
) (*Deferred[struct{}], error) PagesRemoveAttributesPagesRemoveAttributes submits DatabaseOn.PagesRemoveAttributes.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesRemoveAttributes(
collections Collections,
keys, elements []Key,
fields Tape,
config *WriteConfig,
) (*Deferred[struct{}], error) PagesSetAttributesPagesSetAttributes submits DatabaseOn.PagesSetAttributes.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesSetAttributes(
collections Collections,
keys, elements []Key,
fields, values Tape,
config *WriteConfig,
) (*Deferred[struct{}], error) PagesSplicePagesSplice submits DatabaseOn.PagesSplice.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) PagesSplice(
collections Collections,
keys, elements []Key,
textStarts, textLengths []uint64,
values Tape,
config *WriteConfig,
) (*Deferred[struct{}], error) StringsRemoveStringsRemove submits DatabaseOn.StringsRemove.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) StringsRemove(
collections Collections,
strings Tape,
config *StringsRemoveConfig,
) (*Deferred[struct{}], error) StringsWriteStringsWrite submits DatabaseOn.StringsWrite.
Inherited from deferredWrites[Handle]
func (on TransactionDeferredOn) StringsWrite(
collections Collections,
strings Tape,
values []Key,
config *WriteConfig,
) (*Deferred[struct{}], error) EnumWatchWatch is whether a transaction records the keys a call reads or writes, to refuse its commit when another writer changes them first.2
type Watch int32 Values
WatchKeys | WatchKeys records the keys, so a concurrent change to any of them fails the commit. | |
|---|---|---|
WatchNone | WatchNone records nothing, so concurrent changes to these keys never fail the commit. |
WatchFromNameWatchFromName reads a watch back from the spelling Watch.String renders.
func WatchFromName(name string) (Watch, error) StringString renders the watch as the library spells it.
func (watch Watch) String() string