statestore

package
v0.0.0-...-d7cfa30 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: LGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package statestore is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStateStore

type MockStateStore struct {
	// contains filtered or unexported fields
}

MockStateStore is a mock of StateStore interface.

func NewMockStateStore

func NewMockStateStore(ctrl *gomock.Controller) *MockStateStore

NewMockStateStore creates a new mock instance.

func (*MockStateStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStateStore) GetAccountValue

func (m *MockStateStore) GetAccountValue(addr common.Address) (types.AccountValue, error)

GetAccountValue mocks base method.

func (*MockStateStore) GetChildren

func (m *MockStateStore) GetChildren(height uint64, rootHash common.Hash) ([]common.Hash, error)

GetChildren mocks base method.

func (*MockStateStore) GetCodeByHash

func (m *MockStateStore) GetCodeByHash(codeHash common.Hash) ([]byte, error)

GetCodeByHash mocks base method.

func (*MockStateStore) GetLayerLog

func (m *MockStateStore) GetLayerLog(height uint64, rootHash common.Hash) (types.LayerLog, error)

GetLayerLog mocks base method.

func (*MockStateStore) GetPersistedHeight

func (m *MockStateStore) GetPersistedHeight() (uint64, common.Hash, error)

GetPersistedHeight mocks base method.

func (*MockStateStore) GetStorageByVersion

func (m *MockStateStore) GetStorageByVersion(addr common.Address, version uint64, key common.Hash) (common.Hash, error)

GetStorageByVersion mocks base method.

func (*MockStateStore) NewTransaction

func (m *MockStateStore) NewTransaction() (Transaction, error)

NewTransaction mocks base method.

func (*MockStateStore) Shutdown

func (m *MockStateStore) Shutdown()

Shutdown mocks base method.

type MockStateStoreMockRecorder

type MockStateStoreMockRecorder struct {
	// contains filtered or unexported fields
}

MockStateStoreMockRecorder is the mock recorder for MockStateStore.

func (*MockStateStoreMockRecorder) GetAccountValue

func (mr *MockStateStoreMockRecorder) GetAccountValue(addr any) *gomock.Call

GetAccountValue indicates an expected call of GetAccountValue.

func (*MockStateStoreMockRecorder) GetChildren

func (mr *MockStateStoreMockRecorder) GetChildren(height, rootHash any) *gomock.Call

GetChildren indicates an expected call of GetChildren.

func (*MockStateStoreMockRecorder) GetCodeByHash

func (mr *MockStateStoreMockRecorder) GetCodeByHash(codeHash any) *gomock.Call

GetCodeByHash indicates an expected call of GetCodeByHash.

func (*MockStateStoreMockRecorder) GetLayerLog

func (mr *MockStateStoreMockRecorder) GetLayerLog(height, rootHash any) *gomock.Call

GetLayerLog indicates an expected call of GetLayerLog.

func (*MockStateStoreMockRecorder) GetPersistedHeight

func (mr *MockStateStoreMockRecorder) GetPersistedHeight() *gomock.Call

GetPersistedHeight indicates an expected call of GetPersistedHeight.

func (*MockStateStoreMockRecorder) GetStorageByVersion

func (mr *MockStateStoreMockRecorder) GetStorageByVersion(addr, version, key any) *gomock.Call

GetStorageByVersion indicates an expected call of GetStorageByVersion.

func (*MockStateStoreMockRecorder) NewTransaction

func (mr *MockStateStoreMockRecorder) NewTransaction() *gomock.Call

NewTransaction indicates an expected call of NewTransaction.

func (*MockStateStoreMockRecorder) Shutdown

func (mr *MockStateStoreMockRecorder) Shutdown() *gomock.Call

Shutdown indicates an expected call of Shutdown.

type MockTransaction

type MockTransaction struct {
	// contains filtered or unexported fields
}

MockTransaction is a mock of Transaction interface.

func NewMockTransaction

func NewMockTransaction(ctrl *gomock.Controller) *MockTransaction

NewMockTransaction creates a new mock instance.

func (*MockTransaction) Commit

func (m *MockTransaction) Commit() error

Commit mocks base method.

func (*MockTransaction) DeleteChildren

func (m *MockTransaction) DeleteChildren(height uint64, rootHash common.Hash) error

DeleteChildren mocks base method.

func (*MockTransaction) DeleteLayerLog

func (m *MockTransaction) DeleteLayerLog(height uint64, rootHash common.Hash) error

DeleteLayerLog mocks base method.

func (*MockTransaction) Discard

func (m *MockTransaction) Discard()

Discard mocks base method.

func (*MockTransaction) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTransaction) PersistLayerLog

func (m *MockTransaction) PersistLayerLog(layerLog types.LayerLog) error

PersistLayerLog mocks base method.

func (*MockTransaction) PutChildren

func (m *MockTransaction) PutChildren(height uint64, rootHash common.Hash, children []common.Hash) error

PutChildren mocks base method.

func (*MockTransaction) PutLayerLog

func (m *MockTransaction) PutLayerLog(layerLog types.LayerLog) error

PutLayerLog mocks base method.

type MockTransactionMockRecorder

type MockTransactionMockRecorder struct {
	// contains filtered or unexported fields
}

MockTransactionMockRecorder is the mock recorder for MockTransaction.

func (*MockTransactionMockRecorder) Commit

func (mr *MockTransactionMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit.

func (*MockTransactionMockRecorder) DeleteChildren

func (mr *MockTransactionMockRecorder) DeleteChildren(height, rootHash any) *gomock.Call

DeleteChildren indicates an expected call of DeleteChildren.

func (*MockTransactionMockRecorder) DeleteLayerLog

func (mr *MockTransactionMockRecorder) DeleteLayerLog(height, rootHash any) *gomock.Call

DeleteLayerLog indicates an expected call of DeleteLayerLog.

func (*MockTransactionMockRecorder) Discard

func (mr *MockTransactionMockRecorder) Discard() *gomock.Call

Discard indicates an expected call of Discard.

func (*MockTransactionMockRecorder) PersistLayerLog

func (mr *MockTransactionMockRecorder) PersistLayerLog(layerLog any) *gomock.Call

PersistLayerLog indicates an expected call of PersistLayerLog.

func (*MockTransactionMockRecorder) PutChildren

func (mr *MockTransactionMockRecorder) PutChildren(height, rootHash, children any) *gomock.Call

PutChildren indicates an expected call of PutChildren.

func (*MockTransactionMockRecorder) PutLayerLog

func (mr *MockTransactionMockRecorder) PutLayerLog(layerLog any) *gomock.Call

PutLayerLog indicates an expected call of PutLayerLog.

type Opts

type Opts struct {
	// Path to the data store
	Path string

	// GC Period
	GCPeriod time.Duration

	// The IO Timeout
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Opts is the options for state store.

type StateStore

type StateStore interface {
	// GetPersistedHeight gets the persisted state height and root.
	GetPersistedHeight() (uint64, common.Hash, error)

	// GetChildren gets the child states for a state with the given root hash.
	GetChildren(height uint64, rootHash common.Hash) ([]common.Hash, error)

	// GetLayerLog gets the layer log for a state with the given root hash.
	GetLayerLog(height uint64, rootHash common.Hash) (itypes.LayerLog, error)

	// GetAccountValue gets the persisted account value for given address.
	GetAccountValue(addr common.Address) (itypes.AccountValue, error)

	// GetStorageByVersion gets the persisted storage value for given key.
	GetStorageByVersion(addr common.Address, version uint64, key common.Hash) (common.Hash, error)

	// GetCodeByHash gets the persisted code for given hash.
	GetCodeByHash(codeHash common.Hash) ([]byte, error)

	// NewTransaction creates a new transaction to write.
	NewTransaction() (Transaction, error)

	// Shutdown safely shuts the statestore down.
	Shutdown()
}

func NewStateStoreImpl

func NewStateStoreImpl(ctx context.Context, opts Opts, genesis *core.Genesis, genesisRoot common.Hash) (StateStore, error)

NewStateStoreImpl creates a new StateStore

type Transaction

type Transaction interface {
	// Persist layer log by applying all the changes.
	// It includes update persisted height, root hash and commit all changes.
	PersistLayerLog(layerLog itypes.LayerLog) error

	// PutChildren puts children to the state with the given root hash.
	PutChildren(height uint64, rootHash common.Hash, children []common.Hash) error

	// DeleteChildren deletes children of the state with the given root hash.
	DeleteChildren(height uint64, rootHash common.Hash) error

	// PutLayerLog puts layer log to the state with the given root hash.
	PutLayerLog(layerLog itypes.LayerLog) error

	// DeleteLayerLog deletes layer log of the state with the given root hash.
	DeleteLayerLog(height uint64, rootHash common.Hash) error

	// Commit commits all changes.
	Commit() error

	// Discard discards all changes.
	Discard()
}

Jump to

Keyboard shortcuts

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