MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / Begin

Method Begin

tx.go:82–85  ·  view source on GitHub ↗

Begin opens a new transaction. Multiple read-only transactions can be opened at the same time but there can only be one read/write transaction at a time. Attempting to open a read/write transactions while another one is in progress will result in blocking until the current read/write transaction is

(writable bool)

Source from the content-addressed store, hash-verified

80// the current read/write transaction is completed.
81// All transactions must be closed by calling Commit() or Rollback() when done.
82func (db *DB) Begin(writable bool) (tx *Tx, err error) {
83 // Use TransactionManager so we guard via db.mu when acquiring new transactions
84 return db.transactionMgr.BeginTx(writable, true)
85}
86
87// newTx returns a newly initialized Tx object at given writable.
88func newTx(db *DB, writable bool) (tx *Tx, err error) {

Callers 15

managedMethod · 0.95
TestIsPrefixScanFunction · 0.80
TestIsPrefixSearchScanFunction · 0.80
TestTx_PutAndGetFunction · 0.80
TestTx_GetAfterDeleteFunction · 0.80
TestTx_RangeScan_ErrFunction · 0.80
TestTx_RangeScanFunction · 0.80
TestTx_PrefixScanFunction · 0.80
TestTx_PrefixSearchScanFunction · 0.80
TestTx_DeleteAndGetFunction · 0.80

Calls 1

BeginTxMethod · 0.80

Tested by 15

TestIsPrefixScanFunction · 0.64
TestIsPrefixSearchScanFunction · 0.64
TestTx_PutAndGetFunction · 0.64
TestTx_GetAfterDeleteFunction · 0.64
TestTx_RangeScan_ErrFunction · 0.64
TestTx_RangeScanFunction · 0.64
TestTx_PrefixScanFunction · 0.64
TestTx_PrefixSearchScanFunction · 0.64
TestTx_DeleteAndGetFunction · 0.64