cache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheMiss = errors.New("not found in cache")

Functions

This section is empty.

Types

type StateCache

type StateCache interface {
	GetStateObject(addr common.Address) (*StateObject, error)
	WriteStateObject(addr common.Address, data StateObject) error

	GetSlotData(addr common.Address, slot common.Hash) (common.Hash, error)
	WriteSlotData(addr common.Address, slot common.Hash, data common.Hash) error
}

func NewNonPersistentCache

func NewNonPersistentCache() (StateCache, error)

func NewPersistentCache

func NewPersistentCache(ctx context.Context, rpcAddr string, height uint64) (StateCache, error)

NewPersistentCache creates a new set of persistent caches that will persist cache content to disk. Each cache is indexed by the RPC address (to separate network caches) and blockNum

type StateObject

type StateObject struct {
	Balance *uint256.Int
	Nonce   uint64
	Code    []byte
}

StateObject gives us a way to store state objects without the overhead of using geth's stateObject

Jump to

Keyboard shortcuts

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