Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedFormat = errors.New("unsupported format") )
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a pre-image cannot be found in the KV store.
Functions ¶
This section is empty.
Types ¶
type KV ¶
type KV interface { // Put puts the pre-image value v in the key-value store with key k. // KV store implementations may return additional errors specific to the KV storage. Put(k common.Hash, v []byte) error // Get retrieves the pre-image with key k from the key-value store. // It returns ErrNotFound when the pre-image cannot be found. // KV store implementations may return additional errors specific to the KV storage. Get(k common.Hash) ([]byte, error) // Closes the KV store. Close() error }
KV is a Key-Value store interface for pre-image data.
func NewDiskKV ¶
NewDiskKV creates a new KV implementation. If the specified directly contains an existing KV store that has the format recorded, the recorded format is used ensuring compatibility with the existing data. If the directory does not contain existing data or doesn't have the format recorded, defaultFormat is used which may result in the existing data being unused. If the existing data records a format that is not supported, an error is returned. The format is automatically recorded if it wasn't previously stored.
type LocalPreimageSource ¶ added in v1.0.5
type LocalPreimageSource struct {
// contains filtered or unexported fields
}
func NewLocalPreimageSource ¶ added in v1.0.5
func NewLocalPreimageSource(config *config.Config) *LocalPreimageSource
type MemKV ¶
MemKV implements the KV store interface in memory, backed by a regular Go map. This should only be used in testing, as large programs may require more pre-image data than available memory. MemKV is safe for concurrent use.
type PreimageSourceSplitter ¶ added in v1.0.5
type PreimageSourceSplitter struct {
// contains filtered or unexported fields
}
func NewPreimageSourceSplitter ¶ added in v1.0.5
func NewPreimageSourceSplitter(local PreimageSource, global PreimageSource) *PreimageSourceSplitter