state

package
v0.0.0-...-c80a3f0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WALCollectorRam = 2 * (etl.BufferOptimalSize / 16)

3 history + 4 indices = 10 etl collectors, 10*256Mb/16 = 256mb - for all indices buffers

Functions

func DecodeAccountBytes

func DecodeAccountBytes(enc []byte) (nonce uint64, balance *uint256.Int, hash []byte)

func EncodeAccountBytes

func EncodeAccountBytes(nonce uint64, balance *uint256.Int, hash []byte, incarnation uint64) []byte

Types

type Agg22Collation

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

func (Agg22Collation) Close

func (c Agg22Collation) Close()

type Agg22StaticFiles

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

func (Agg22StaticFiles) Close

func (sf Agg22StaticFiles) Close()

type Aggregator

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

func NewAggregator

func NewAggregator(
	dir, tmpdir string,
	aggregationStep uint64,
) (*Aggregator, error)

func (*Aggregator) AddLogAddr

func (a *Aggregator) AddLogAddr(addr []byte) error

func (*Aggregator) AddLogTopic

func (a *Aggregator) AddLogTopic(topic []byte) error

func (*Aggregator) AddTraceFrom

func (a *Aggregator) AddTraceFrom(addr []byte) error

func (*Aggregator) AddTraceTo

func (a *Aggregator) AddTraceTo(addr []byte) error

func (*Aggregator) Close

func (a *Aggregator) Close()

func (*Aggregator) ComputeCommitment

func (a *Aggregator) ComputeCommitment(saveStateAfter, trace bool) (rootHash []byte, err error)

Evaluates commitment for processed state. Commit=true - store trie state after evaluation

func (*Aggregator) DeleteAccount

func (a *Aggregator) DeleteAccount(addr []byte) error

func (*Aggregator) EndTxNumMinimax

func (a *Aggregator) EndTxNumMinimax() uint64

func (*Aggregator) FinishTx

func (a *Aggregator) FinishTx() error

func (*Aggregator) FinishWrites

func (a *Aggregator) FinishWrites()

func (*Aggregator) Flush

func (a *Aggregator) Flush(ctx context.Context) error

Flush - must be called before Collate, if you did some writes

func (*Aggregator) GetAndResetStats

func (a *Aggregator) GetAndResetStats() DomainStats

func (*Aggregator) MakeContext

func (a *Aggregator) MakeContext() *AggregatorContext

func (*Aggregator) ReadyToFinishTx

func (a *Aggregator) ReadyToFinishTx() bool

func (*Aggregator) SeekCommitment

func (a *Aggregator) SeekCommitment() (txNum uint64, err error)

func (*Aggregator) SetBlockNum

func (a *Aggregator) SetBlockNum(bn uint64)

todo useless

func (*Aggregator) SetCommitFn

func (a *Aggregator) SetCommitFn(fn func(txNum uint64) error)

func (*Aggregator) SetCommitmentMode

func (a *Aggregator) SetCommitmentMode(mode CommitmentMode)

func (*Aggregator) SetTx

func (a *Aggregator) SetTx(tx kv.RwTx)

func (*Aggregator) SetTxNum

func (a *Aggregator) SetTxNum(txNum uint64)

func (*Aggregator) SetWorkers

func (a *Aggregator) SetWorkers(i int)

func (*Aggregator) StartWrites

func (a *Aggregator) StartWrites() *Aggregator

StartWrites - pattern: `defer agg.StartWrites().FinishWrites()`

func (*Aggregator) Stats

func (a *Aggregator) Stats() FilesStats

func (*Aggregator) UpdateAccountCode

func (a *Aggregator) UpdateAccountCode(addr []byte, code []byte) error

func (*Aggregator) UpdateAccountData

func (a *Aggregator) UpdateAccountData(addr []byte, account []byte) error

func (*Aggregator) UpdateCommitmentData

func (a *Aggregator) UpdateCommitmentData(prefix []byte, code []byte) error

func (*Aggregator) WriteAccountStorage

func (a *Aggregator) WriteAccountStorage(addr, loc []byte, value []byte) error

type Aggregator22

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

func NewAggregator22

func NewAggregator22(dir, tmpdir string, aggregationStep uint64, db kv.RoDB) (*Aggregator22, error)

func (*Aggregator22) Accounts

func (a *Aggregator22) Accounts() *History

func (*Aggregator22) AddAccountPrev

func (a *Aggregator22) AddAccountPrev(addr []byte, prev []byte) error

func (*Aggregator22) AddCodePrev

func (a *Aggregator22) AddCodePrev(addr []byte, prev []byte) error

AddCodePrev - addr+inc => code

func (*Aggregator22) AddLogAddr

func (a *Aggregator22) AddLogAddr(addr []byte) error

func (*Aggregator22) AddLogTopic

func (a *Aggregator22) AddLogTopic(topic []byte) error

func (*Aggregator22) AddStoragePrev

func (a *Aggregator22) AddStoragePrev(addr []byte, loc []byte, prev []byte) error

func (*Aggregator22) AddTraceFrom

func (a *Aggregator22) AddTraceFrom(addr []byte) error

func (*Aggregator22) AddTraceTo

func (a *Aggregator22) AddTraceTo(addr []byte) error

func (*Aggregator22) BuildFiles

func (a *Aggregator22) BuildFiles(ctx context.Context, db kv.RoDB) (err error)

func (*Aggregator22) BuildFilesInBackground

func (a *Aggregator22) BuildFilesInBackground(ctx context.Context, db kv.RoDB) error

func (*Aggregator22) BuildMissedIndices

func (a *Aggregator22) BuildMissedIndices(ctx context.Context, sem *semaphore.Weighted) error

func (*Aggregator22) CanPrune

func (a *Aggregator22) CanPrune(tx kv.Tx) bool

func (*Aggregator22) CanPruneFrom

func (a *Aggregator22) CanPruneFrom(tx kv.Tx) uint64

func (*Aggregator22) Close

func (a *Aggregator22) Close()

func (*Aggregator22) Code

func (a *Aggregator22) Code() *History

func (*Aggregator22) DisableReadAhead

func (a *Aggregator22) DisableReadAhead()

DisableReadAhead - usage: `defer d.EnableReadAhead().DisableReadAhead()`. Please don't use this funcs without `defer` to avoid leak.

func (*Aggregator22) DiscardHistory

func (a *Aggregator22) DiscardHistory() *Aggregator22

StartWrites - pattern: `defer agg.StartWrites().FinishWrites()`

func (*Aggregator22) EnableMadvNormal

func (a *Aggregator22) EnableMadvNormal() *Aggregator22

func (*Aggregator22) EnableMadvWillNeed

func (a *Aggregator22) EnableMadvWillNeed() *Aggregator22

func (*Aggregator22) EnableReadAhead

func (a *Aggregator22) EnableReadAhead() *Aggregator22

func (*Aggregator22) EndTxNumMinimax

func (a *Aggregator22) EndTxNumMinimax() uint64

func (*Aggregator22) Files

func (a *Aggregator22) Files() (res []string)

func (*Aggregator22) FinishWrites

func (a *Aggregator22) FinishWrites()

func (*Aggregator22) Flush

func (a *Aggregator22) Flush(ctx context.Context, tx kv.RwTx) error

func (*Aggregator22) KeepInDB

func (a *Aggregator22) KeepInDB(v uint64)

KeepInDB - usually equal to one a.aggregationStep, but when we exec blocks from snapshots we can set it to 0, because no re-org on this blocks are possible

func (*Aggregator22) LogStats

func (a *Aggregator22) LogStats(tx kv.Tx, tx2block func(endTxNumMinimax uint64) uint64)

func (*Aggregator22) MakeContext

func (a *Aggregator22) MakeContext() *Aggregator22Context

func (*Aggregator22) MakeSteps

func (a *Aggregator22) MakeSteps() []*AggregatorStep

func (*Aggregator22) MergeLoop

func (a *Aggregator22) MergeLoop(ctx context.Context, workers int) error

func (*Aggregator22) Prune

func (a *Aggregator22) Prune(ctx context.Context, limit uint64) error

func (*Aggregator22) PruneWithTiemout

func (a *Aggregator22) PruneWithTiemout(ctx context.Context, timeout time.Duration) error

func (*Aggregator22) ReopenFiles

func (a *Aggregator22) ReopenFiles() error

func (*Aggregator22) SetLogPrefix

func (a *Aggregator22) SetLogPrefix(v string)

func (*Aggregator22) SetTx

func (a *Aggregator22) SetTx(tx kv.RwTx)

func (*Aggregator22) SetTxNum

func (a *Aggregator22) SetTxNum(txNum uint64)

func (*Aggregator22) SetWorkers

func (a *Aggregator22) SetWorkers(i int)

func (*Aggregator22) StartWrites

func (a *Aggregator22) StartWrites() *Aggregator22

StartWrites - pattern: `defer agg.StartWrites().FinishWrites()`

func (*Aggregator22) Stats

func (a *Aggregator22) Stats() FilesStats22

func (*Aggregator22) Storage

func (a *Aggregator22) Storage() *History

func (*Aggregator22) Unwind

func (a *Aggregator22) Unwind(ctx context.Context, txUnwindTo uint64, stateLoad etl.LoadFunc) error

func (*Aggregator22) Warmup

func (a *Aggregator22) Warmup(txFrom, limit uint64)

type Aggregator22Context

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

func (*Aggregator22Context) LogAddrIterator

func (ac *Aggregator22Context) LogAddrIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*Aggregator22Context) LogTopicIterator

func (ac *Aggregator22Context) LogTopicIterator(topic []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*Aggregator22Context) ReadAccountCodeNoState

func (ac *Aggregator22Context) ReadAccountCodeNoState(addr []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountCodeNoStateWithRecent

func (ac *Aggregator22Context) ReadAccountCodeNoStateWithRecent(addr []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountCodeSizeNoState

func (ac *Aggregator22Context) ReadAccountCodeSizeNoState(addr []byte, txNum uint64) (int, bool, error)

func (*Aggregator22Context) ReadAccountCodeSizeNoStateWithRecent

func (ac *Aggregator22Context) ReadAccountCodeSizeNoStateWithRecent(addr []byte, txNum uint64) (int, bool, error)

func (*Aggregator22Context) ReadAccountDataNoState

func (ac *Aggregator22Context) ReadAccountDataNoState(addr []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountDataNoStateWithRecent

func (ac *Aggregator22Context) ReadAccountDataNoStateWithRecent(addr []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountStorageNoState

func (ac *Aggregator22Context) ReadAccountStorageNoState(addr []byte, loc []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountStorageNoStateWithRecent

func (ac *Aggregator22Context) ReadAccountStorageNoStateWithRecent(addr []byte, loc []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) ReadAccountStorageNoStateWithRecent2

func (ac *Aggregator22Context) ReadAccountStorageNoStateWithRecent2(key []byte, txNum uint64) ([]byte, bool, error)

func (*Aggregator22Context) SetTx

func (ac *Aggregator22Context) SetTx(tx kv.Tx)

func (*Aggregator22Context) TraceFromIterator

func (ac *Aggregator22Context) TraceFromIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*Aggregator22Context) TraceToIterator

func (ac *Aggregator22Context) TraceToIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

type AggregatorContext

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

func (*AggregatorContext) LogAddrIterator

func (ac *AggregatorContext) LogAddrIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*AggregatorContext) LogTopicIterator

func (ac *AggregatorContext) LogTopicIterator(topic []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*AggregatorContext) ReadAccountCode

func (ac *AggregatorContext) ReadAccountCode(addr []byte, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadAccountCodeBeforeTxNum

func (ac *AggregatorContext) ReadAccountCodeBeforeTxNum(addr []byte, txNum uint64, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadAccountCodeSize

func (ac *AggregatorContext) ReadAccountCodeSize(addr []byte, roTx kv.Tx) (int, error)

func (*AggregatorContext) ReadAccountCodeSizeBeforeTxNum

func (ac *AggregatorContext) ReadAccountCodeSizeBeforeTxNum(addr []byte, txNum uint64, roTx kv.Tx) (int, error)

func (*AggregatorContext) ReadAccountData

func (ac *AggregatorContext) ReadAccountData(addr []byte, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadAccountDataBeforeTxNum

func (ac *AggregatorContext) ReadAccountDataBeforeTxNum(addr []byte, txNum uint64, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadAccountStorage

func (ac *AggregatorContext) ReadAccountStorage(addr []byte, loc []byte, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadAccountStorageBeforeTxNum

func (ac *AggregatorContext) ReadAccountStorageBeforeTxNum(addr []byte, loc []byte, txNum uint64, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadCommitment

func (ac *AggregatorContext) ReadCommitment(addr []byte, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) ReadCommitmentBeforeTxNum

func (ac *AggregatorContext) ReadCommitmentBeforeTxNum(addr []byte, txNum uint64, roTx kv.Tx) ([]byte, error)

func (*AggregatorContext) TraceFromIterator

func (ac *AggregatorContext) TraceFromIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

func (*AggregatorContext) TraceToIterator

func (ac *AggregatorContext) TraceToIterator(addr []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

type AggregatorStep

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

AggregatorStep is used for incremental reconstitution, it allows accessing history in isolated way for each step

func (*AggregatorStep) Clone

func (as *AggregatorStep) Clone() *AggregatorStep

func (*AggregatorStep) IterateAccountsHistory

func (as *AggregatorStep) IterateAccountsHistory(txNum uint64) *HistoryIteratorInc

func (*AggregatorStep) IterateAccountsTxs

func (as *AggregatorStep) IterateAccountsTxs() *ScanIteratorInc

func (*AggregatorStep) IterateCodeHistory

func (as *AggregatorStep) IterateCodeHistory(txNum uint64) *HistoryIteratorInc

func (*AggregatorStep) IterateCodeTxs

func (as *AggregatorStep) IterateCodeTxs() *ScanIteratorInc

func (*AggregatorStep) IterateStorageHistory

func (as *AggregatorStep) IterateStorageHistory(txNum uint64) *HistoryIteratorInc

func (*AggregatorStep) IterateStorageTxs

func (as *AggregatorStep) IterateStorageTxs() *ScanIteratorInc

func (*AggregatorStep) MaxTxNumAccounts

func (as *AggregatorStep) MaxTxNumAccounts(addr []byte) (bool, uint64)

func (*AggregatorStep) MaxTxNumCode

func (as *AggregatorStep) MaxTxNumCode(addr []byte) (bool, uint64)

func (*AggregatorStep) MaxTxNumStorage

func (as *AggregatorStep) MaxTxNumStorage(addr []byte, loc []byte) (bool, uint64)

func (*AggregatorStep) ReadAccountCodeNoState

func (as *AggregatorStep) ReadAccountCodeNoState(addr []byte, txNum uint64) ([]byte, bool, uint64)

func (*AggregatorStep) ReadAccountCodeSizeNoState

func (as *AggregatorStep) ReadAccountCodeSizeNoState(addr []byte, txNum uint64) (int, bool, uint64)

func (*AggregatorStep) ReadAccountDataNoState

func (as *AggregatorStep) ReadAccountDataNoState(addr []byte, txNum uint64) ([]byte, bool, uint64)

func (*AggregatorStep) ReadAccountStorageNoState

func (as *AggregatorStep) ReadAccountStorageNoState(addr []byte, loc []byte, txNum uint64) ([]byte, bool, uint64)

func (*AggregatorStep) TxNumRange

func (as *AggregatorStep) TxNumRange() (uint64, uint64)

type BackgroundResult

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

BackgroundResult - used only indicate that some work is done no much reason to pass exact results by this object, just get latest state when need

func (*BackgroundResult) GetAndReset

func (br *BackgroundResult) GetAndReset() (bool, error)

func (*BackgroundResult) Has

func (br *BackgroundResult) Has() bool

func (*BackgroundResult) Set

func (br *BackgroundResult) Set(err error)

type Collation

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

Collation is the set of compressors created after aggregation

func (Collation) Close

func (c Collation) Close()

type CommitmentItem

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

type CommitmentMode

type CommitmentMode uint

Defines how to evaluate commitments

const (
	CommitmentModeDisabled CommitmentMode = 0
	CommitmentModeDirect   CommitmentMode = 1
	CommitmentModeUpdate   CommitmentMode = 2
)

type CursorHeap

type CursorHeap []*CursorItem

func (CursorHeap) Len

func (ch CursorHeap) Len() int

func (CursorHeap) Less

func (ch CursorHeap) Less(i, j int) bool

func (*CursorHeap) Pop

func (ch *CursorHeap) Pop() interface{}

func (*CursorHeap) Push

func (ch *CursorHeap) Push(x interface{})

func (*CursorHeap) Swap

func (ch *CursorHeap) Swap(i, j int)

type CursorItem

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

CursorItem is the item in the priority queue used to do merge interation over storage of a given account

type CursorType

type CursorType uint8
const (
	FILE_CURSOR CursorType = iota
	DB_CURSOR
)

type Domain

type Domain struct {
	*History
	// contains filtered or unexported fields
}

Domain is a part of the state (examples are Accounts, Storage, Code) Domain should not have any go routines or locks

func NewDomain

func NewDomain(
	dir, tmpdir string,
	aggregationStep uint64,
	filenameBase string,
	keysTable string,
	valsTable string,
	indexKeysTable string,
	historyValsTable string,
	settingsTable string,
	indexTable string,
	prefixLen int,
	compressVals bool,
) (*Domain, error)

func (*Domain) BuildMissedIndices

func (d *Domain) BuildMissedIndices(ctx context.Context, sem *semaphore.Weighted) (err error)

BuildMissedIndices - produce .efi/.vi/.kvi from .ef/.v/.kv

func (*Domain) Close

func (d *Domain) Close()

func (*Domain) Delete

func (d *Domain) Delete(key1, key2 []byte) error

func (*Domain) GetAndResetStats

func (d *Domain) GetAndResetStats() DomainStats

func (*Domain) MakeContext

func (d *Domain) MakeContext() *DomainContext

func (*Domain) Put

func (d *Domain) Put(key1, key2, val []byte) error

type DomainCommitted

type DomainCommitted struct {
	*Domain
	// contains filtered or unexported fields
}

func NewCommittedDomain

func NewCommittedDomain(d *Domain, mode CommitmentMode) *DomainCommitted

func (*DomainCommitted) ComputeCommitment

func (d *DomainCommitted) ComputeCommitment(trace bool) (rootHash []byte, branchNodeUpdates map[string]commitment.BranchData, err error)

Evaluates commitment for processed state. Commit=true - store trie state after evaluation

func (*DomainCommitted) SeekCommitment

func (d *DomainCommitted) SeekCommitment(aggStep, sinceTx uint64) (uint64, error)

SeekCommitment searches for last encoded state from DomainCommitted and if state found, sets it up to current domain

func (*DomainCommitted) SetCommitmentMode

func (d *DomainCommitted) SetCommitmentMode(m CommitmentMode)

func (*DomainCommitted) SetKeyReplacer

func (d *DomainCommitted) SetKeyReplacer(vm ValueMerger)

func (*DomainCommitted) TouchPlainKey

func (d *DomainCommitted) TouchPlainKey(key, val []byte, fn func(c *CommitmentItem, val []byte))

TouchPlainKey marks plainKey as updated and applies different fn for different key types (different behaviour for Code, Account and Storage key modifications).

func (*DomainCommitted) TouchPlainKeyAccount

func (d *DomainCommitted) TouchPlainKeyAccount(c *CommitmentItem, val []byte)

func (*DomainCommitted) TouchPlainKeyCode

func (d *DomainCommitted) TouchPlainKeyCode(c *CommitmentItem, val []byte)

func (*DomainCommitted) TouchPlainKeyStorage

func (d *DomainCommitted) TouchPlainKeyStorage(c *CommitmentItem, val []byte)

func (*DomainCommitted) TouchedKeyList

func (d *DomainCommitted) TouchedKeyList() ([][]byte, [][]byte, []commitment.Update)

Returns list of both plain and hashed keys. If .mode is CommitmentModeUpdate, updates also returned.

type DomainContext

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

DomainContext allows accesing the same domain from multiple go-routines

func (*DomainContext) Get

func (dc *DomainContext) Get(key1, key2 []byte, roTx kv.Tx) ([]byte, error)

func (*DomainContext) GetBeforeTxNum

func (dc *DomainContext) GetBeforeTxNum(key []byte, txNum uint64, roTx kv.Tx) ([]byte, error)

GetBeforeTxNum does not always require usage of roTx. If it is possible to determine historical value based only on static files, roTx will not be used.

func (*DomainContext) IteratePrefix

func (dc *DomainContext) IteratePrefix(prefix []byte, it func(k, v []byte)) error

IteratePrefix iterates over key-value pairs of the domain that start with given prefix The length of the prefix has to match the `prefixLen` parameter used to create the domain Such iteration is not intended to be used in public API, therefore it uses read-write transaction inside the domain. Another version of this for public API use needs to be created, that uses roTx instead and supports ending the iterations before it reaches the end.

type DomainRanges

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

type DomainStats

type DomainStats struct {
	MergesCount    uint64
	HistoryQueries uint64
	EfSearchTime   time.Duration
	DataSize       uint64
	IndexSize      uint64
	FilesCount     uint64
}

func (*DomainStats) Accumulate

func (ds *DomainStats) Accumulate(other DomainStats)

type FilesStats

type FilesStats struct {
	TxCount    uint64
	FilesCount uint64
	IdxSize    uint64
	DataSize   uint64
}

type FilesStats22

type FilesStats22 struct {
}

type History

type History struct {
	*InvertedIndex
	// contains filtered or unexported fields
}

func NewHistory

func NewHistory(
	dir, tmpdir string,
	aggregationStep uint64,
	filenameBase string,
	indexKeysTable string,
	indexTable string,
	historyValsTable string,
	settingsTable string,
	compressVals bool,
	integrityFileExtensions []string,
) (*History, error)

func (*History) AddPrevValue

func (h *History) AddPrevValue(key1, key2, original []byte) (err error)

func (*History) BuildMissedIndices

func (h *History) BuildMissedIndices(ctx context.Context, sem *semaphore.Weighted) (err error)

BuildMissedIndices - produce .efi/.vi/.kvi from .ef/.v/.kv

func (*History) Close

func (h *History) Close()

func (*History) DisableReadAhead

func (h *History) DisableReadAhead()

func (*History) DiscardHistory

func (h *History) DiscardHistory(tmpdir string)

func (*History) EnableMadvNormalReadAhead

func (h *History) EnableMadvNormalReadAhead() *History

func (*History) EnableMadvWillNeed

func (h *History) EnableMadvWillNeed() *History

func (*History) EnableReadAhead

func (h *History) EnableReadAhead() *History

func (*History) Files

func (h *History) Files() (res []string)

func (*History) FinishWrites

func (h *History) FinishWrites()

func (*History) MakeContext

func (h *History) MakeContext() *HistoryContext

func (*History) MakeSteps

func (h *History) MakeSteps(toTxNum uint64) []*HistoryStep

MakeSteps [0, toTxNum)

func (*History) Rotate

func (h *History) Rotate() historyFlusher

func (*History) StartWrites

func (h *History) StartWrites(tmpdir string)

type HistoryCollation

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

func (HistoryCollation) Close

func (c HistoryCollation) Close()

type HistoryContext

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

func (*HistoryContext) GetNoState

func (hc *HistoryContext) GetNoState(key []byte, txNum uint64) ([]byte, bool, error)

func (*HistoryContext) GetNoStateWithRecent

func (hc *HistoryContext) GetNoStateWithRecent(key []byte, txNum uint64, roTx kv.Tx) ([]byte, bool, error)

GetNoStateWithRecent searches history for a value of specified key before txNum second return value is true if the value is found in the history (even if it is nil)

func (*HistoryContext) IterateChanged

func (hc *HistoryContext) IterateChanged(startTxNum, endTxNum uint64, roTx kv.Tx) *HistoryIterator1

func (*HistoryContext) IterateRecentlyChanged

func (hc *HistoryContext) IterateRecentlyChanged(startTxNum, endTxNum uint64, roTx kv.Tx, f func([]byte, []byte) error) error

func (*HistoryContext) IterateRecentlyChangedUnordered

func (hc *HistoryContext) IterateRecentlyChangedUnordered(startTxNum, endTxNum uint64, roTx kv.Tx) *HistoryIterator2

func (*HistoryContext) SetTx

func (hc *HistoryContext) SetTx(tx kv.Tx)

type HistoryFiles

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

func (HistoryFiles) Close

func (sf HistoryFiles) Close()

type HistoryIterator1

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

func (*HistoryIterator1) Close

func (hi *HistoryIterator1) Close()

func (*HistoryIterator1) HasNext

func (hi *HistoryIterator1) HasNext() bool

func (*HistoryIterator1) Next

func (hi *HistoryIterator1) Next(keyBuf, valBuf []byte) ([]byte, []byte)

func (*HistoryIterator1) Stat

func (hi *HistoryIterator1) Stat() (int, int)

type HistoryIterator2

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

func (*HistoryIterator2) Close

func (hi *HistoryIterator2) Close()

func (*HistoryIterator2) HasNext

func (hi *HistoryIterator2) HasNext() bool

func (*HistoryIterator2) Next

func (hi *HistoryIterator2) Next() ([]byte, []byte)

func (*HistoryIterator2) Stat

func (hi *HistoryIterator2) Stat() int

type HistoryIteratorInc

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

func (*HistoryIteratorInc) HasNext

func (hii *HistoryIteratorInc) HasNext() bool

func (*HistoryIteratorInc) Next

func (hii *HistoryIteratorInc) Next() ([]byte, []byte)

type HistoryRanges

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

func (HistoryRanges) String

func (r HistoryRanges) String(aggStep uint64) string

type HistoryStep

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

HistoryStep used for incremental state reconsitution, it isolates only one snapshot interval

func (*HistoryStep) Clone

func (hs *HistoryStep) Clone() *HistoryStep

func (*HistoryStep) GetNoState

func (hs *HistoryStep) GetNoState(key []byte, txNum uint64) ([]byte, bool, uint64)

func (*HistoryStep) MaxTxNum

func (hs *HistoryStep) MaxTxNum(key []byte) (bool, uint64)

type InvertedFiles

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

func (InvertedFiles) Close

func (sf InvertedFiles) Close()

type InvertedIndex

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

func NewInvertedIndex

func NewInvertedIndex(
	dir, tmpdir string,
	aggregationStep uint64,
	filenameBase string,
	indexKeysTable string,
	indexTable string,
	integrityFileExtensions []string,
) (*InvertedIndex, error)

func (*InvertedIndex) Add

func (ii *InvertedIndex) Add(key []byte) error

func (*InvertedIndex) BuildMissedIndices

func (ii *InvertedIndex) BuildMissedIndices(ctx context.Context, sem *semaphore.Weighted) (err error)

BuildMissedIndices - produce .efi/.vi/.kvi from .ef/.v/.kv

func (*InvertedIndex) Close

func (ii *InvertedIndex) Close()

func (*InvertedIndex) DisableReadAhead

func (ii *InvertedIndex) DisableReadAhead()

func (*InvertedIndex) DiscardHistory

func (ii *InvertedIndex) DiscardHistory(tmpdir string)

func (*InvertedIndex) EnableMadvNormalReadAhead

func (ii *InvertedIndex) EnableMadvNormalReadAhead() *InvertedIndex

func (*InvertedIndex) EnableMadvWillNeed

func (ii *InvertedIndex) EnableMadvWillNeed() *InvertedIndex

func (*InvertedIndex) EnableReadAhead

func (ii *InvertedIndex) EnableReadAhead() *InvertedIndex

func (*InvertedIndex) Files

func (ii *InvertedIndex) Files() (res []string)

func (*InvertedIndex) FinishWrites

func (ii *InvertedIndex) FinishWrites()

func (*InvertedIndex) MakeContext

func (ii *InvertedIndex) MakeContext() *InvertedIndexContext

func (*InvertedIndex) Rotate

func (ii *InvertedIndex) Rotate() *invertedIndexWAL

func (*InvertedIndex) SetTx

func (ii *InvertedIndex) SetTx(tx kv.RwTx)

func (*InvertedIndex) SetTxNum

func (ii *InvertedIndex) SetTxNum(txNum uint64)

func (*InvertedIndex) StartWrites

func (ii *InvertedIndex) StartWrites(tmpdir string)

type InvertedIndexContext

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

func (*InvertedIndexContext) IterateChangedKeys

func (ic *InvertedIndexContext) IterateChangedKeys(startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator1

func (*InvertedIndexContext) IterateRange

func (ic *InvertedIndexContext) IterateRange(key []byte, startTxNum, endTxNum uint64, roTx kv.Tx) InvertedIterator

IterateRange is to be used in public API, therefore it relies on read-only transaction so that iteration can be done even when the inverted index is being updated. [startTxNum; endNumTx)

type InvertedIterator

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

InvertedIterator allows iteration over range of tx numbers Iteration is not implmented via callback function, because there is often a requirement for interators to be composable (for example, to implement AND and OR for indices) InvertedIterator must be closed after use to prevent leaking of resources like cursor

func (*InvertedIterator) Close

func (it *InvertedIterator) Close()

func (*InvertedIterator) HasNext

func (it *InvertedIterator) HasNext() bool

func (*InvertedIterator) Next

func (it *InvertedIterator) Next() uint64

func (*InvertedIterator) ToBitamp

func (it *InvertedIterator) ToBitamp() *roaring64.Bitmap

type InvertedIterator1

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

func (*InvertedIterator1) Close

func (it *InvertedIterator1) Close()

func (*InvertedIterator1) HasNext

func (it *InvertedIterator1) HasNext() bool

func (*InvertedIterator1) Next

func (it *InvertedIterator1) Next(keyBuf []byte) []byte

type MergedFiles

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

func (MergedFiles) Close

func (mf MergedFiles) Close()

type MergedFiles22

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

func (MergedFiles22) Close

func (mf MergedFiles22) Close()

type RCollation

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

func (RCollation) Close

func (c RCollation) Close()

type RMergedFiles

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

func (RMergedFiles) Close

func (mf RMergedFiles) Close()

type RRanges

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

type RSelectedStaticFiles

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

func (RSelectedStaticFiles) Close

func (sf RSelectedStaticFiles) Close()

type RStaticFiles

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

func (RStaticFiles) Close

func (sf RStaticFiles) Close()

type Ranges

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

type Ranges22

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

type ReadIndices

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

func NewReadIndices

func NewReadIndices(
	dir, tmpdir string,
	aggregationStep uint64,
) (*ReadIndices, error)

func (*ReadIndices) Close

func (ri *ReadIndices) Close()

func (*ReadIndices) FinishTx

func (ri *ReadIndices) FinishTx() error

func (*ReadIndices) ReadAccountCode

func (ri *ReadIndices) ReadAccountCode(addr []byte) error

func (*ReadIndices) ReadAccountCodeSize

func (ri *ReadIndices) ReadAccountCodeSize(addr []byte) error

func (*ReadIndices) ReadAccountData

func (ri *ReadIndices) ReadAccountData(addr []byte) error

func (*ReadIndices) ReadAccountStorage

func (ri *ReadIndices) ReadAccountStorage(addr []byte, loc []byte) error

func (*ReadIndices) SetTx

func (ri *ReadIndices) SetTx(tx kv.RwTx)

func (*ReadIndices) SetTxNum

func (ri *ReadIndices) SetTxNum(txNum uint64)

type ReconHeap

type ReconHeap []*ReconItem

func (ReconHeap) Len

func (rh ReconHeap) Len() int

func (ReconHeap) Less

func (rh ReconHeap) Less(i, j int) bool

Less (part of heap.Interface) compares two links. For persisted links, those with the lower block heights get evicted first. This means that more recently persisted links are preferred. For non-persisted links, those with the highest block heights get evicted first. This is to prevent "holes" in the block heights that may cause inability to insert headers in the ascending order of their block heights.

func (*ReconHeap) Pop

func (rh *ReconHeap) Pop() interface{}

Pop (part of heap.Interface) removes the first link from the queue

func (*ReconHeap) Push

func (rh *ReconHeap) Push(x interface{})

Push (part of heap.Interface) places a new link onto the end of queue. Note that idx attribute is set to the correct position of the new link

func (ReconHeap) Swap

func (rh ReconHeap) Swap(i, j int)

Swap (part of heap.Interface) moves two links in the queue into each other's places. Note that each link has idx attribute that is getting adjusted during the swap. The idx attribute allows the removal of links from the middle of the queue (in case if links are getting invalidated due to failed verification of unavailability of parent headers)

type ReconItem

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

type ScanIteratorInc

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

func (*ScanIteratorInc) HasNext

func (sii *ScanIteratorInc) HasNext() bool

func (*ScanIteratorInc) Next

func (si *ScanIteratorInc) Next() uint64

type SelectedStaticFiles

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

func (SelectedStaticFiles) Close

func (sf SelectedStaticFiles) Close()

type SelectedStaticFiles22

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

func (SelectedStaticFiles22) Close

func (sf SelectedStaticFiles22) Close()

type StaticFiles

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

func (StaticFiles) Close

func (sf StaticFiles) Close()

type ValueMerger

type ValueMerger func(prev, current []byte) (merged []byte, err error)

Jump to

Keyboard shortcuts

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