tx

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package tx provides transaction management for gograph's storage layer.

Package tx provides transaction management for gograph's storage layer.

Index

Constants

This section is empty.

Variables

View Source
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

func NewManager(store *storage.DB) *Manager

NewManager creates a new transaction manager for the given storage.

func (*Manager) Begin

func (m *Manager) Begin(readOnly bool) (*Transaction, error)

Begin starts a new transaction. If readOnly is true, the transaction cannot modify data but may have better performance.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL