storage

package
v0.33.31 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDatabase added in v0.31.0

type BlockDatabase struct {
	*primary.BlockData
	*derived.DerivedBlockData
}

BlockDatabase packages the primary index (BlockData) and secondary indices (DerivedBlockData) into a single database via 2PC.

func NewBlockDatabase added in v0.31.0

func NewBlockDatabase(
	storageSnapshot snapshot.StorageSnapshot,
	snapshotTime logical.Time,
	cachedDerivedBlockData *derived.DerivedBlockData,
) *BlockDatabase

NOTE: storageSnapshot must be thread safe.

func (*BlockDatabase) NewCachingSnapshotReadTransaction added in v0.33.19

func (database *BlockDatabase) NewCachingSnapshotReadTransaction(
	parameters state.StateParameters,
) (Transaction, error)

NewCachingSnapshotReadTransaction creates a new readonly transaction that allows writing to the derived transaction data table.

func (*BlockDatabase) NewSnapshotReadTransaction added in v0.31.0

func (database *BlockDatabase) NewSnapshotReadTransaction(
	parameters state.StateParameters,
) Transaction

NewSnapshotReadTransaction creates a new readonly transaction.

func (*BlockDatabase) NewTransaction added in v0.31.0

func (database *BlockDatabase) NewTransaction(
	executionTime logical.Time,
	parameters state.StateParameters,
) (
	Transaction,
	error,
)

type Transaction

type Transaction interface {
	TransactionPreparer

	// SnapshotTime returns the transaction's current snapshot time.
	SnapshotTime() logical.Time

	// Finalize convert transaction preparer's intermediate state into
	// committable state.
	Finalize() error

	// Validate returns nil if the transaction does not conflict with
	// previously committed transactions.  It returns an error otherwise.
	Validate() error

	// Commit commits the transaction.  If the transaction conflict with
	// previously committed transactions, an error is returned and the
	// transaction is not committed.
	Commit() (*snapshot.ExecutionSnapshot, error)
}

type TransactionPreparer added in v0.31.0

type TransactionPreparer interface {
	state.NestedTransactionPreparer
	derived.DerivedTransactionPreparer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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