Documentation
¶
Overview ¶
Package tx provides transaction management for gograph's storage layer.
Package tx provides transaction management for gograph's storage layer.
Index ¶
- Variables
- type Manager
- type Transaction
- func (t *Transaction) Commit() error
- func (t *Transaction) Delete(key []byte) error
- func (t *Transaction) Get(key []byte) ([]byte, error)
- func (t *Transaction) IsClosed() bool
- func (t *Transaction) IsReadOnly() bool
- func (t *Transaction) Put(key, value []byte) error
- func (t *Transaction) Rollback() error
Constants ¶
This section is empty.
Variables ¶
var ( ErrTransactionClosed = errors.New("transaction closed") ErrReadOnlyTransaction = errors.New("read only transaction") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager creates and manages transactions for the storage layer.
func NewManager ¶
NewManager creates a new transaction manager for the given storage.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a database transaction. It provides methods for reading and writing data within a transaction.
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
Commit commits the transaction, making all changes permanent.
func (*Transaction) Delete ¶
func (t *Transaction) Delete(key []byte) error
Delete removes the value for the given key within the transaction.
func (*Transaction) Get ¶
func (t *Transaction) Get(key []byte) ([]byte, error)
Get retrieves the value for the given key within the transaction.
func (*Transaction) IsClosed ¶
func (t *Transaction) IsClosed() bool
IsClosed returns true if the transaction has been closed.
func (*Transaction) IsReadOnly ¶
func (t *Transaction) IsReadOnly() bool
IsReadOnly returns true if the transaction is read-only.
func (*Transaction) Put ¶
func (t *Transaction) Put(key, value []byte) error
Put stores a key-value pair within the transaction.
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
Rollback aborts the transaction and discards all changes.