storage

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

func TestStorage

func TestStorage(t *testing.T, m PlaceholderStorage)

TestStorage tests a set of tests on a storage

Types

type Factory

type Factory func(config map[string]interface{}, logger hclog.Logger) (Storage, error)

Factory is a factory method to create a blockchain storage

type Forks

type Forks []types.Hash

func (*Forks) MarshalRLPTo

func (f *Forks) MarshalRLPTo(dst []byte) []byte

MarshalRLPTo is a wrapper function for calling the type marshal implementation

func (*Forks) MarshalRLPWith

func (f *Forks) MarshalRLPWith(ar *fastrlp.Arena) *fastrlp.Value

MarshalRLPWith is the actual RLP marshal implementation for the type

func (*Forks) UnmarshalRLP

func (f *Forks) UnmarshalRLP(input []byte) error

UnmarshalRLP is a wrapper function for calling the type unmarshal implementation

func (*Forks) UnmarshalRLPFrom

func (f *Forks) UnmarshalRLPFrom(p *fastrlp.Parser, v *fastrlp.Value) error

UnmarshalRLPFrom is the actual RLP unmarshal implementation for the type

type MockStorage

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

func NewMockStorage added in v0.5.3

func NewMockStorage() *MockStorage

func (*MockStorage) Close added in v0.5.3

func (m *MockStorage) Close() error

func (*MockStorage) HookClose added in v0.5.3

func (m *MockStorage) HookClose(fn closeDelegate)

func (*MockStorage) HookReadBody added in v0.5.3

func (m *MockStorage) HookReadBody(fn readBodyDelegate)

func (*MockStorage) HookReadCanonicalHash added in v0.5.3

func (m *MockStorage) HookReadCanonicalHash(fn readCanonicalHashDelegate)

func (*MockStorage) HookReadForks added in v0.5.3

func (m *MockStorage) HookReadForks(fn readForksDelegate)

func (*MockStorage) HookReadHeadHash added in v0.5.3

func (m *MockStorage) HookReadHeadHash(fn readHeadHashDelegate)

func (*MockStorage) HookReadHeadNumber added in v0.5.3

func (m *MockStorage) HookReadHeadNumber(fn readHeadNumberDelegate)

func (*MockStorage) HookReadHeader added in v0.5.3

func (m *MockStorage) HookReadHeader(fn readHeaderDelegate)

func (*MockStorage) HookReadReceipts added in v0.5.3

func (m *MockStorage) HookReadReceipts(fn readReceiptsDelegate)

func (*MockStorage) HookReadTotalDifficulty added in v0.5.3

func (m *MockStorage) HookReadTotalDifficulty(fn readTotalDifficultyDelegate)

func (*MockStorage) HookReadTxLookup added in v0.5.3

func (m *MockStorage) HookReadTxLookup(fn readTxLookupDelegate)

func (*MockStorage) HookWriteBody added in v0.5.3

func (m *MockStorage) HookWriteBody(fn writeBodyDelegate)

func (*MockStorage) HookWriteCanonicalHash added in v0.5.3

func (m *MockStorage) HookWriteCanonicalHash(fn writeCanonicalHashDelegate)

func (*MockStorage) HookWriteCanonicalHeader added in v0.5.3

func (m *MockStorage) HookWriteCanonicalHeader(fn writeCanonicalHeaderDelegate)

func (*MockStorage) HookWriteForks added in v0.5.3

func (m *MockStorage) HookWriteForks(fn writeForksDelegate)

func (*MockStorage) HookWriteHeadHash added in v0.5.3

func (m *MockStorage) HookWriteHeadHash(fn writeHeadHashDelegate)

func (*MockStorage) HookWriteHeadNumber added in v0.5.3

func (m *MockStorage) HookWriteHeadNumber(fn writeHeadNumberDelegate)

func (*MockStorage) HookWriteHeader added in v0.5.3

func (m *MockStorage) HookWriteHeader(fn writeHeaderDelegate)

func (*MockStorage) HookWriteReceipts added in v0.5.3

func (m *MockStorage) HookWriteReceipts(fn writeReceiptsDelegate)

func (*MockStorage) HookWriteTotalDifficulty added in v0.5.3

func (m *MockStorage) HookWriteTotalDifficulty(fn writeTotalDifficultyDelegate)

func (*MockStorage) HookWriteTxLookup added in v0.5.3

func (m *MockStorage) HookWriteTxLookup(fn writeTxLookupDelegate)

func (*MockStorage) ReadBody added in v0.5.3

func (m *MockStorage) ReadBody(hash types.Hash) (*types.Body, error)

func (*MockStorage) ReadCanonicalHash added in v0.5.3

func (m *MockStorage) ReadCanonicalHash(n uint64) (types.Hash, bool)

func (*MockStorage) ReadForks added in v0.5.3

func (m *MockStorage) ReadForks() ([]types.Hash, error)

func (*MockStorage) ReadHeadHash added in v0.5.3

func (m *MockStorage) ReadHeadHash() (types.Hash, bool)

func (*MockStorage) ReadHeadNumber added in v0.5.3

func (m *MockStorage) ReadHeadNumber() (uint64, bool)

func (*MockStorage) ReadHeader added in v0.5.3

func (m *MockStorage) ReadHeader(hash types.Hash) (*types.Header, error)

func (*MockStorage) ReadReceipts added in v0.5.3

func (m *MockStorage) ReadReceipts(hash types.Hash) ([]*types.Receipt, error)

func (*MockStorage) ReadTotalDifficulty added in v0.5.3

func (m *MockStorage) ReadTotalDifficulty(hash types.Hash) (*big.Int, bool)

func (*MockStorage) ReadTxLookup added in v0.5.3

func (m *MockStorage) ReadTxLookup(hash types.Hash) (types.Hash, bool)

func (*MockStorage) WriteBody added in v0.5.3

func (m *MockStorage) WriteBody(hash types.Hash, body *types.Body) error

func (*MockStorage) WriteCanonicalHash added in v0.5.3

func (m *MockStorage) WriteCanonicalHash(n uint64, hash types.Hash) error

func (*MockStorage) WriteCanonicalHeader added in v0.5.3

func (m *MockStorage) WriteCanonicalHeader(h *types.Header, diff *big.Int) error

func (*MockStorage) WriteForks added in v0.5.3

func (m *MockStorage) WriteForks(forks []types.Hash) error

func (*MockStorage) WriteHeadHash added in v0.5.3

func (m *MockStorage) WriteHeadHash(h types.Hash) error

func (*MockStorage) WriteHeadNumber added in v0.5.3

func (m *MockStorage) WriteHeadNumber(n uint64) error

func (*MockStorage) WriteHeader added in v0.5.3

func (m *MockStorage) WriteHeader(h *types.Header) error

func (*MockStorage) WriteReceipts added in v0.5.3

func (m *MockStorage) WriteReceipts(hash types.Hash, receipts []*types.Receipt) error

func (*MockStorage) WriteTotalDifficulty added in v0.5.3

func (m *MockStorage) WriteTotalDifficulty(hash types.Hash, diff *big.Int) error

func (*MockStorage) WriteTxLookup added in v0.5.3

func (m *MockStorage) WriteTxLookup(hash types.Hash, blockHash types.Hash) error

type PlaceholderStorage added in v0.5.3

type PlaceholderStorage func(t *testing.T) (Storage, func())

type Storage

type Storage interface {
	ReadCanonicalHash(n uint64) (types.Hash, bool)
	WriteCanonicalHash(n uint64, hash types.Hash) error

	ReadHeadHash() (types.Hash, bool)
	ReadHeadNumber() (uint64, bool)
	WriteHeadHash(h types.Hash) error
	WriteHeadNumber(uint64) error

	WriteForks(forks []types.Hash) error
	ReadForks() ([]types.Hash, error)

	WriteTotalDifficulty(hash types.Hash, diff *big.Int) error
	ReadTotalDifficulty(hash types.Hash) (*big.Int, bool)

	WriteHeader(h *types.Header) error
	ReadHeader(hash types.Hash) (*types.Header, error)

	WriteCanonicalHeader(h *types.Header, diff *big.Int) error

	WriteBody(hash types.Hash, body *types.Body) error
	ReadBody(hash types.Hash) (*types.Body, error)

	WriteReceipts(hash types.Hash, receipts []*types.Receipt) error
	ReadReceipts(hash types.Hash) ([]*types.Receipt, error)

	WriteTxLookup(hash types.Hash, blockHash types.Hash) error
	ReadTxLookup(hash types.Hash) (types.Hash, bool)

	Close() error
}

Storage is a generic blockchain storage

type StorageBuilder added in v1.1.4

type StorageBuilder interface {
	Build() (Storage, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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