store

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStoreSizeLimit uint64 = 1_073_741_824 // 1GiB
View Source
var ErrInvalidFullKVFile = errors.New("unmarshal store error") // this error will bubble up to the user
View Source
var ErrNoQuickSaveStore = fmt.Errorf("no quick save store")
View Source
var ErrNotFound = errors.New("store not found")
View Source
var ErrStoreAboveMaxSize = errors.New("store above max size")
View Source
var ErrStoreBackendFailure = errors.New("store backend failure")

ErrStoreBackendFailure marks a store operation that failed for reasons that are NOT a function of the module's input: disk full, mmap grow / ENOMEM, I/O error, or writing to a closed store. It only arises on the mmap backend (the memory backend's Set/Delete cannot fail). It is non-deterministic — a retry on a healthy node can succeed — so callers must NOT cache it as a deterministic error (see pipeline/exec.baseexec).

View Source
var ErrStoreEntryTooLarge = errors.New("store entry too large")

ErrStoreEntryTooLarge marks a key that exceeds the backend size limit. It is a function of the module's output, hence a deterministic error (it is not in the non-deterministic ErrStoreBackendFailure family below).

Functions

func FilenamePrefix added in v1.13.0

func FilenamePrefix(blockNum uint64) string

func FullStateFileName added in v1.1.3

func FullStateFileName(r *block.Range) string

func PartialFileName added in v1.1.3

func PartialFileName(r *block.Range) string

func SetMetadataDetached added in v1.20.0

func SetMetadataDetached(metaStore dstore.Store, filename, storeName string, metadata map[string]string, logger *zap.Logger)

SetMetadataDetached writes store metadata in the background WITHOUT retaining the FullKV or riding the caller's request context.

Callers previously spawned `go func(){ fullKV.Store().SetMetadata(reqCtx, ...) }()`, which (1) captured the whole multi-GB fullKV until the write returned, pinning it long after the request could otherwise release it, and (2) ran on the request ctx, so a canceled/finished request killed the write. This helper takes only the store, filename and name, and runs on a bounded background context, so the write survives request cancellation and pins nothing.

Types

type Appender

type Appender interface {
	Append(ord uint64, key string, value []byte)
}

type ConditionalKeySetter

type ConditionalKeySetter interface {
	SetIfNotExists(ord uint64, key string, value string)
	SetBytesIfNotExists(ord uint64, key string, value []byte)
}

type Config

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

func NewConfig

func NewConfig(
	name string,
	moduleInitialBlock uint64,
	moduleHash string,
	updatePolicy pbsubstreams.Module_KindStore_UpdatePolicy,
	valueType string,
	store dstore.Store,
	quickSaveStore dstore.Store,
	storeSizeLimit uint64,
	scratchSpace string,
	backend string,
) (*Config, error)

func (*Config) ExistsFullKV added in v1.4.0

func (c *Config) ExistsFullKV(ctx context.Context, upTo uint64) (bool, error)

func (*Config) ExistsPartialKV added in v1.4.0

func (c *Config) ExistsPartialKV(ctx context.Context, from, to uint64) (bool, error)

func (*Config) FileSize

func (c *Config) FileSize(ctx context.Context, fileInfo *FileInfo) (int64, error)

func (*Config) ListSnapshotFiles

func (c *Config) ListSnapshotFiles(ctx context.Context, from uint64, inclusiveTo *uint64) (files []*FileInfo, err error)

func (*Config) ModuleHash

func (c *Config) ModuleHash() string

func (*Config) ModuleInitialBlock

func (c *Config) ModuleInitialBlock() uint64

func (*Config) Name

func (c *Config) Name() string

func (*Config) NewFullKV

func (c *Config) NewFullKV(logger *zap.Logger) *FullKV

func (*Config) NewPartialKV

func (c *Config) NewPartialKV(initialBlock uint64, logger *zap.Logger) *PartialKV

func (*Config) UpdatePolicy

func (*Config) ValueType

func (c *Config) ValueType() string

type ConfigMap

type ConfigMap map[string]*Config

func NewConfigMap

func NewConfigMap(baseObjectStore, quickSaveStore dstore.Store, storeModules []*pbsubstreams.Module, moduleHashes map[string]string, firstStreamableBlock uint64, storeSizeLimit uint64, scratchSpace string, backend string) (out ConfigMap, err error)

NewConfigMap creates a ConfigMap for the given store modules. storeSizeLimit, if non-zero, overrides the default StoreSizeLimit for all stores in this map.

type DeletedPrefixes added in v1.15.6

type DeletedPrefixes map[string]struct{}

DeletedPrefixes is a specialized map to track deleted prefixes

func (DeletedPrefixes) Add added in v1.15.6

func (dp DeletedPrefixes) Add(prefix string)

Add adds a key to the DeletedPrefixes map

func (DeletedPrefixes) Clear added in v1.15.6

func (dp DeletedPrefixes) Clear()

Clear removes all entries in the DeletedPrefixes map

func (DeletedPrefixes) Exists added in v1.15.6

func (dp DeletedPrefixes) Exists(prefix string) bool

func (DeletedPrefixes) RemoveMatching added in v1.15.6

func (dp DeletedPrefixes) RemoveMatching(key string)

RemoveMatching removes all prefixes of the given string

type Deleter

type Deleter interface {
	DeletePrefix(ord uint64, prefix string)
}

type DeltaAccessor

type DeltaAccessor interface {
	SetDeltas([]*pbsubstreams.StoreDelta)
	GetDeltas() []*pbsubstreams.StoreDelta
	ReadOps() []byte
	Flush() error
	ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)
	ApplyDelta(delta *pbsubstreams.StoreDelta)
	ApplyOps(in []byte) error
}

type FileInfo

type FileInfo struct {
	ModuleName  string
	Filename    string
	Range       *block.Range
	Partial     bool
	WithTraceID bool
}

func CompleteFile added in v1.1.3

func CompleteFile(in string, params ...FileInfoParam) *FileInfo

CompleteFile returns a FileInfo for the given range, infallibly, panics on errors, ideal for tests.

func NewCompleteFileInfo added in v1.1.3

func NewCompleteFileInfo(moduleName string, moduleInitialBlock uint64, exclusiveEndBlock uint64) *FileInfo

func NewPartialFileInfo added in v1.1.3

func NewPartialFileInfo(moduleName string, start uint64, exclusiveEndBlock uint64) *FileInfo

func PartialFile added in v1.1.3

func PartialFile(in string, params ...FileInfoParam) *FileInfo

PartialFile returns a FileInfo for the given range, infallibly, panics on errors, ideal for tests.

type FileInfoParam added in v1.1.3

type FileInfoParam interface {
	// contains filtered or unexported methods
}

type FileInfos added in v1.1.3

type FileInfos []*FileInfo

func CompleteFiles added in v1.1.3

func CompleteFiles(in string, params ...FileInfoParam) FileInfos

CompleteFiles returns a list of FileInfo for the given ranges, infallibly, panics on errors, ideal for tests.

func PartialFiles added in v1.1.3

func PartialFiles(in string, params ...FileInfoParam) FileInfos

PartialFiles returns a list of FileInfo for the given ranges, infallibly, panics on errors, ideal for tests.

func (FileInfos) Ranges added in v1.1.3

func (f FileInfos) Ranges() (out block.Ranges)

func (FileInfos) String added in v1.1.3

func (f FileInfos) String() string

type FullKV

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

func (FullKV) Append

func (b FullKV) Append(ord uint64, key string, value []byte)

func (FullKV) ApplyDelta

func (b FullKV) ApplyDelta(delta *pbsubstreams.StoreDelta)

func (FullKV) ApplyDeltasReverse

func (b FullKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)

func (FullKV) ApplyOps added in v1.4.0

func (b FullKV) ApplyOps(in []byte) error

func (FullKV) Close added in v1.20.0

func (b FullKV) Close() error

func (*FullKV) Delete added in v1.17.11

func (s *FullKV) Delete(ctx context.Context, file *FileInfo) error

func (FullKV) DeletePrefix

func (b FullKV) DeletePrefix(ord uint64, prefix string)

func (*FullKV) DerivePartialStore

func (s *FullKV) DerivePartialStore(initialBlock uint64) *PartialKV

func (*FullKV) Filename added in v1.17.3

func (s *FullKV) Filename() string

func (FullKV) Flush added in v1.5.6

func (b FullKV) Flush() (err error)

func (FullKV) GetAt

func (b FullKV) GetAt(ord uint64, key string) (out []byte, found bool)

GetAt returns the key for the state that includes the processing of `ord`.

func (FullKV) GetDeltas

func (b FullKV) GetDeltas() []*pbsubstreams.StoreDelta

func (FullKV) GetFirst

func (b FullKV) GetFirst(key string) ([]byte, bool)

func (FullKV) GetLast

func (b FullKV) GetLast(key string) ([]byte, bool)

func (*FullKV) GetSize added in v1.17.3

func (s *FullKV) GetSize(ctx context.Context, filename string) (compressedSize uint64, uncompressedSize *uint64, metadata map[string]string, err error)

func (FullKV) HasAt added in v1.0.0

func (b FullKV) HasAt(ord uint64, key string) bool

HasAt returns true if the key exists for the state that includes the processing of `ord`.

func (FullKV) HasFirst added in v1.0.0

func (b FullKV) HasFirst(key string) bool

func (FullKV) HasLast added in v1.0.0

func (b FullKV) HasLast(key string) bool

func (FullKV) InitialBlock

func (b FullKV) InitialBlock() uint64

func (FullKV) Iter

func (b FullKV) Iter(f func(key string, value []byte) error) error

func (FullKV) Length

func (b FullKV) Length() uint64

func (*FullKV) Load

func (s *FullKV) Load(ctx context.Context, file *FileInfo) error

func (FullKV) MarshalLogObject

func (b FullKV) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*FullKV) Marshaller

func (s *FullKV) Marshaller() marshaller.Marshaller

func (FullKV) Merge

func (b FullKV) Merge(kvPartialStore *PartialKV) error

Merge nextStore _into_ `s`, where nextStore is for the next contiguous segment's store output.

func (FullKV) Name

func (b FullKV) Name() string

func (*FullKV) QuickLoad added in v1.14.0

func (s *FullKV) QuickLoad(ctx context.Context, atBlock bstream.BlockRef) error

QuickLoad opens and streams the quicksave file in one call. It is equivalent to QuickLoadOpen followed by QuickLoadFinish and exists for callers that don't need to interleave work between the (cheap) open and the (slow) streaming decode.

func (*FullKV) QuickLoadClose added in v1.20.1

func (s *FullKV) QuickLoadClose()

QuickLoadClose discards a reader opened by QuickLoadOpen without streaming it, used to release resources when a sibling store's open failed and the whole quickload is being abandoned.

func (*FullKV) QuickLoadFinish added in v1.20.1

func (s *FullKV) QuickLoadFinish(ctx context.Context, atBlock bstream.BlockRef) error

QuickLoadFinish streams the object opened by QuickLoadOpen into the store and closes it. It must be called after a successful QuickLoadOpen.

func (*FullKV) QuickLoadOpen added in v1.20.1

func (s *FullKV) QuickLoadOpen(ctx context.Context, atBlock bstream.BlockRef) error

QuickLoadOpen opens the quicksave object for atBlock, confirming it exists and is readable, but does not stream it yet. Pairing this with a later QuickLoadFinish lets the caller do work (e.g. send the client its session/trace-id and keepalives) during the potentially slow streaming decode instead of before it.

func (*FullKV) QuickSave added in v1.14.0

func (s *FullKV) QuickSave(ctx context.Context, atBlockHash string) error

func (FullKV) ReadOps added in v1.5.6

func (b FullKV) ReadOps() []byte

func (FullKV) Reset

func (b FullKV) Reset()

func (*FullKV) Save

func (s *FullKV) Save(endBoundaryBlock uint64) (*FileInfo, *fileWriter, error)

Save is to be called ONLY when we just passed the `nextExpectedBoundary` and processed nothing more after that boundary.

Locking / ops note: Save opens a Snapshot and returns a fileWriter that the caller uploads to object storage LATER; the snapshot stays open (and is only released by fileWriter.Write -> reader.Close -> snap.Close) for the whole upload. On the mmap backend the snapshot holds the exclusive snapMu the whole time, so every write to this store AND Close() block until the upload finishes. This is intentional (the store must be frozen while it is serialized), and is bounded by ctx cancellation of the Write. But be aware: a multi-GB save over slow/stuck object storage wedges this store until the write's deadline. The memory backend copies its snapshot up front (no write-gate) but is otherwise equivalent in externally observable behaviour.

func (FullKV) Set

func (b FullKV) Set(ord uint64, key string, value string)

func (FullKV) SetBytes

func (b FullKV) SetBytes(ord uint64, key string, value []byte)

func (FullKV) SetBytesIfNotExists

func (b FullKV) SetBytesIfNotExists(ord uint64, key string, value []byte)

func (FullKV) SetDeltas

func (b FullKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)

func (FullKV) SetIfNotExists

func (b FullKV) SetIfNotExists(ord uint64, key string, value string)

func (FullKV) SetMaxBigDecimal

func (b FullKV) SetMaxBigDecimal(ord uint64, key string, value decimal.Decimal)

func (FullKV) SetMaxBigInt

func (b FullKV) SetMaxBigInt(ord uint64, key string, value *big.Int)

func (FullKV) SetMaxFloat64

func (b FullKV) SetMaxFloat64(ord uint64, key string, value float64)

func (FullKV) SetMaxInt64

func (b FullKV) SetMaxInt64(ord uint64, key string, value int64)

func (FullKV) SetMinBigDecimal

func (b FullKV) SetMinBigDecimal(ord uint64, key string, value decimal.Decimal)

func (FullKV) SetMinBigInt

func (b FullKV) SetMinBigInt(ord uint64, key string, value *big.Int)

func (FullKV) SetMinFloat64

func (b FullKV) SetMinFloat64(ord uint64, key string, value float64)

func (FullKV) SetMinInt64

func (b FullKV) SetMinInt64(ord uint64, key string, value int64)

func (FullKV) SetSumBigDecimal added in v1.7.0

func (b FullKV) SetSumBigDecimal(ord uint64, key string, value []byte)

func (FullKV) SetSumBigInt added in v1.7.0

func (b FullKV) SetSumBigInt(ord uint64, key string, value []byte)

func (FullKV) SetSumFloat64 added in v1.7.0

func (b FullKV) SetSumFloat64(ord uint64, key string, value []byte)

func (FullKV) SetSumInt64 added in v1.7.0

func (b FullKV) SetSumInt64(ord uint64, key string, value []byte)

func (FullKV) SizeBytes added in v1.1.12

func (b FullKV) SizeBytes() uint64

func (*FullKV) Store added in v1.17.3

func (s *FullKV) Store() dstore.Store

func (*FullKV) String

func (s *FullKV) String() string

func (FullKV) SumBigDecimal

func (b FullKV) SumBigDecimal(ord uint64, key string, value decimal.Decimal)

func (FullKV) SumBigInt

func (b FullKV) SumBigInt(ord uint64, key string, value *big.Int)

func (FullKV) SumFloat64

func (b FullKV) SumFloat64(ord uint64, key string, value float64)

func (FullKV) SumInt64

func (b FullKV) SumInt64(ord uint64, key string, value int64)

func (FullKV) UpdatePolicy

func (b FullKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy

func (FullKV) ValueType

func (b FullKV) ValueType() string

type Getter

type Getter interface {
	Get(name string) (Store, bool)
	All() map[string]Store
}

type Iterable

type Iterable interface {
	Length() uint64
	Iter(func(key string, value []byte) error) error
}

type KVImpl added in v1.20.0

type KVImpl interface {
	// Get retrieves the value for a key. Returns (value, true) if found, (nil, false) otherwise.
	Get(key string) ([]byte, bool)

	// Set writes a key-value pair. The value slice must not be modified after this call.
	Set(key string, value []byte) error

	// Delete removes a key. No error if key doesn't exist.
	Delete(key string) error

	// Scan iterates over all keys with a given prefix in lexicographic order.
	// The callback receives (key, value). Return false from the callback to stop iteration.
	// The value slice is only valid during the callback and must not be retained.
	Scan(prefix string, fn func(key string, value []byte) bool) error

	// Iter iterates over all keys and allows the callback to return an error.
	// If the callback returns an error, iteration stops and that error is returned.
	// The value slice is only valid during the callback and must not be retained.
	Iter(fn func(key string, value []byte) error) error

	// Clear removes all key-value pairs, resetting the store to an empty state.
	// For mmap backends this drops and recreates the bbolt bucket in a single transaction.
	// For memory backends this replaces the map with a fresh allocation.
	Clear() error

	// Load replaces the impl's contents from an iterator of StoreDataEntry.
	// This is called during store deserialization (e.g., loading a FullKV snapshot from object storage).
	Load(it iter.Seq2[marshaller.StoreDataEntry, error]) (*marshaller.StoreDataTrailer, error)

	// Save returns an iterator yielding all key-value pairs in sorted order.
	// This is the inverse of Load, streams data out without materializing a map.
	Save() iter.Seq2[marshaller.StoreDataEntry, error]

	// Snapshot returns a pull-based iterator over a stable view of the store in
	// lexicographic key order, used to stream store serialization without
	// materializing it. For the mmap backend, writes to the store are blocked
	// while a snapshot is open so pages read across internal batches stay
	// consistent. The returned iterator MUST be closed.
	Snapshot() (marshaller.KVSnapshotIter, error)

	// BatchSet writes multiple key-value pairs in a single atomic operation.
	// This is significantly faster than calling Set() in a loop for mmap backends
	// because it commits a single transaction instead of one per key.
	// For memory backends it is equivalent to calling Set() in a loop.
	BatchSet(kv map[string][]byte) error

	// GetMany retrieves multiple keys in a single operation.
	// For mmap backends this uses a single read transaction, avoiding the per-call
	// transaction overhead of calling Get() in a loop.
	// Keys not found are omitted from the result map.
	GetMany(keys []string) (map[string][]byte, error)

	// GetManySizes retrieves, in a single operation, the byte length of the
	// value stored at each of the given keys. Keys not found are omitted from
	// the result map (so the map doubles as a presence test). It is the
	// value-free counterpart of GetMany: for the mmap backend it reads value
	// lengths straight out of the bbolt pages without copying the values onto
	// the heap, which the merge path uses for SET/SET_IF_NOT_EXISTS where only
	// prior existence and size (for accounting) matter, not the old bytes.
	GetManySizes(keys []string) (map[string]int, error)

	// KeyCount returns the number of keys currently stored.
	KeyCount() int

	// Close releases any resources held by the implementation (e.g., file handles, mmap regions).
	io.Closer
}

KVImpl is the storage implementation for key-value pairs in baseStore. It abstracts over in-memory (map) and mmap-backed (bbolt) storage. bbolt is the default to prevent OOM kills on large stores.

type KVImplBackendConfig added in v1.20.0

type KVImplBackendConfig interface {
	// contains filtered or unexported methods
}

KVImplBackendConfig holds backend-specific configuration. Each backend implements this interface with its own options.

type KVImplConfig added in v1.20.0

type KVImplConfig struct {
	Type       KVImplType
	StoreName  string
	ModuleHash string
	Backend    KVImplBackendConfig
}

KVImplConfig holds shared configuration for KVImpl creation. Backend holds implementation-specific options; if nil, defaults are used.

func DefaultKVImplConfig added in v1.20.0

func DefaultKVImplConfig(storeName, moduleHash string, backend KVImplBackendConfig) *KVImplConfig

DefaultKVImplConfig returns a KVImplConfig whose Type is derived from the backend argument when provided, falling back to the SUBSTREAMS_STORE_BACKEND env var.

func (*KVImplConfig) NewKVImpl added in v1.20.0

func (cfg *KVImplConfig) NewKVImpl(logger *zap.Logger) (KVImpl, error)

NewKVImpl creates the KVImpl described by this config.

type KVImplType added in v1.20.0

type KVImplType string

KVImplType specifies the storage implementation

const (
	KVImplTypeMmap   KVImplType = "mmap"
	KVImplTypeMemory KVImplType = "memory"
)

type Loadable

type Loadable interface {
	Load(ctx context.Context, file *FileInfo) error
}

type Map

type Map map[string]Store

func NewMap

func NewMap() Map

func (Map) All

func (m Map) All() map[string]Store

func (Map) Get

func (m Map) Get(name string) (Store, bool)

func (Map) MarshalLogObject

func (m Map) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (Map) Names added in v1.14.0

func (m Map) Names() []string

func (*Map) QuickLoad added in v1.14.0

func (m *Map) QuickLoad(ctx context.Context, atBlock bstream.BlockRef) error

func (*Map) QuickLoadClose added in v1.20.1

func (m *Map) QuickLoadClose()

QuickLoadClose releases any readers opened by QuickLoadOpen that were not yet streamed, used to abandon a quickload after a partial open.

func (*Map) QuickLoadFinish added in v1.20.1

func (m *Map) QuickLoadFinish(ctx context.Context, atBlock bstream.BlockRef) error

QuickLoadFinish streams every store's previously-opened quicksave object into the store, then does memory accounting. Must follow a successful QuickLoadOpen.

func (*Map) QuickLoadOpen added in v1.20.1

func (m *Map) QuickLoadOpen(ctx context.Context, atBlock bstream.BlockRef) error

QuickLoadOpen opens every store's quicksave object (confirming they all exist and are readable) without streaming them. If any open fails, every reader opened so far is released before returning, so a failed open leaves no dangling handles. On success the caller must eventually call QuickLoadFinish (or QuickLoadClose).

func (*Map) QuickSave added in v1.14.0

func (m *Map) QuickSave(ctx context.Context, atBlockHash string) error

func (Map) Set

func (m Map) Set(s Store)

type MaxBigDecimalSetter

type MaxBigDecimalSetter interface {
	SetMaxBigDecimal(ord uint64, key string, value decimal.Decimal)
}

type MaxBigIntSetter

type MaxBigIntSetter interface {
	SetMaxBigInt(ord uint64, key string, value *big.Int)
}

type MaxFloat64Setter

type MaxFloat64Setter interface {
	SetMaxFloat64(ord uint64, key string, value float64)
}

type MaxInt64Setter

type MaxInt64Setter interface {
	SetMaxInt64(ord uint64, key string, value int64)
}

type MemoryBackendConfig added in v1.20.0

type MemoryBackendConfig struct{}

MemoryBackendConfig holds in-memory backend options (none currently).

type Mergeable

type Mergeable interface {
	ValueType() string
	UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
}

type MinBigDecimalSetter

type MinBigDecimalSetter interface {
	SetMinBigDecimal(ord uint64, key string, value decimal.Decimal)
}

type MinBigIntSetter

type MinBigIntSetter interface {
	SetMinBigInt(ord uint64, key string, value *big.Int)
}

type MinFloat64Setter

type MinFloat64Setter interface {
	SetMinFloat64(ord uint64, key string, value float64)
}

type MinInt64Setter

type MinInt64Setter interface {
	SetMinInt64(ord uint64, key string, value int64)
}

type MmapBackendConfig added in v1.20.0

type MmapBackendConfig struct {
	ScratchSpace string // base directory for bbolt files; uses OS temp dir if empty

	// InitialMmapSize pre-reserves this many bytes of mmap address space when
	// the bbolt file is opened. bbolt otherwise grows its mmap by doubling and
	// remapping, and each remap must wait for all in-flight transactions to
	// finish and blocks new ones — a stall that recurs O(log size) times while a
	// large store is hydrated (Load) or grown (Merge/BatchSet). This is a
	// virtual reservation only (pages are not resident until touched), so a
	// generous value is cheap on 64-bit. Zero falls back to defaultInitialMmapSize.
	InitialMmapSize int
}

MmapBackendConfig holds mmap (bbolt) specific options.

type Named

type Named interface {
	Name() string
}

type PartialKV

type PartialKV struct {
	DeletedPrefixes []string
	// contains filtered or unexported fields
}

func (PartialKV) Append

func (b PartialKV) Append(ord uint64, key string, value []byte)

func (*PartialKV) ApplyDelta

func (p *PartialKV) ApplyDelta(delta *pbsubstreams.StoreDelta)

func (*PartialKV) ApplyDeltasReverse

func (p *PartialKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)

func (PartialKV) ApplyOps added in v1.4.0

func (b PartialKV) ApplyOps(in []byte) error

func (PartialKV) Close added in v1.20.0

func (b PartialKV) Close() error

func (*PartialKV) DeletePrefix

func (p *PartialKV) DeletePrefix(ord uint64, prefix string)

func (*PartialKV) DeleteStore

func (p *PartialKV) DeleteStore(ctx context.Context, file *FileInfo) (err error)

func (PartialKV) Flush added in v1.5.6

func (b PartialKV) Flush() (err error)

func (PartialKV) GetAt

func (b PartialKV) GetAt(ord uint64, key string) (out []byte, found bool)

GetAt returns the key for the state that includes the processing of `ord`.

func (PartialKV) GetDeltas

func (b PartialKV) GetDeltas() []*pbsubstreams.StoreDelta

func (PartialKV) GetFirst

func (b PartialKV) GetFirst(key string) ([]byte, bool)

func (PartialKV) GetLast

func (b PartialKV) GetLast(key string) ([]byte, bool)

func (PartialKV) HasAt added in v1.0.0

func (b PartialKV) HasAt(ord uint64, key string) bool

HasAt returns true if the key exists for the state that includes the processing of `ord`.

func (PartialKV) HasFirst added in v1.0.0

func (b PartialKV) HasFirst(key string) bool

func (PartialKV) HasLast added in v1.0.0

func (b PartialKV) HasLast(key string) bool

func (*PartialKV) InitialBlock

func (p *PartialKV) InitialBlock() uint64

func (PartialKV) Iter

func (b PartialKV) Iter(f func(key string, value []byte) error) error

func (PartialKV) Length

func (b PartialKV) Length() uint64

func (*PartialKV) Load

func (p *PartialKV) Load(ctx context.Context, file *FileInfo) error

func (PartialKV) MarshalLogObject

func (b PartialKV) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (PartialKV) Merge

func (b PartialKV) Merge(kvPartialStore *PartialKV) error

Merge nextStore _into_ `s`, where nextStore is for the next contiguous segment's store output.

func (PartialKV) Name

func (b PartialKV) Name() string

func (PartialKV) ReadOps added in v1.4.0

func (b PartialKV) ReadOps() []byte

func (PartialKV) Reset

func (b PartialKV) Reset()

func (*PartialKV) Roll

func (p *PartialKV) Roll(lastBlock uint64)

func (*PartialKV) Save

func (p *PartialKV) Save(endBoundaryBlock uint64) (*FileInfo, *fileWriter, error)

func (PartialKV) Set

func (b PartialKV) Set(ord uint64, key string, value string)

func (PartialKV) SetBytes

func (b PartialKV) SetBytes(ord uint64, key string, value []byte)

func (PartialKV) SetBytesIfNotExists

func (b PartialKV) SetBytesIfNotExists(ord uint64, key string, value []byte)

func (PartialKV) SetDeltas

func (b PartialKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)

func (PartialKV) SetIfNotExists

func (b PartialKV) SetIfNotExists(ord uint64, key string, value string)

func (PartialKV) SetMaxBigDecimal

func (b PartialKV) SetMaxBigDecimal(ord uint64, key string, value decimal.Decimal)

func (PartialKV) SetMaxBigInt

func (b PartialKV) SetMaxBigInt(ord uint64, key string, value *big.Int)

func (PartialKV) SetMaxFloat64

func (b PartialKV) SetMaxFloat64(ord uint64, key string, value float64)

func (PartialKV) SetMaxInt64

func (b PartialKV) SetMaxInt64(ord uint64, key string, value int64)

func (PartialKV) SetMinBigDecimal

func (b PartialKV) SetMinBigDecimal(ord uint64, key string, value decimal.Decimal)

func (PartialKV) SetMinBigInt

func (b PartialKV) SetMinBigInt(ord uint64, key string, value *big.Int)

func (PartialKV) SetMinFloat64

func (b PartialKV) SetMinFloat64(ord uint64, key string, value float64)

func (PartialKV) SetMinInt64

func (b PartialKV) SetMinInt64(ord uint64, key string, value int64)

func (PartialKV) SetSumBigDecimal added in v1.7.0

func (b PartialKV) SetSumBigDecimal(ord uint64, key string, value []byte)

func (PartialKV) SetSumBigInt added in v1.7.0

func (b PartialKV) SetSumBigInt(ord uint64, key string, value []byte)

func (PartialKV) SetSumFloat64 added in v1.7.0

func (b PartialKV) SetSumFloat64(ord uint64, key string, value []byte)

func (PartialKV) SetSumInt64 added in v1.7.0

func (b PartialKV) SetSumInt64(ord uint64, key string, value []byte)

func (PartialKV) SizeBytes added in v1.1.12

func (b PartialKV) SizeBytes() uint64

func (*PartialKV) String

func (p *PartialKV) String() string

func (PartialKV) SumBigDecimal

func (b PartialKV) SumBigDecimal(ord uint64, key string, value decimal.Decimal)

func (PartialKV) SumBigInt

func (b PartialKV) SumBigInt(ord uint64, key string, value *big.Int)

func (PartialKV) SumFloat64

func (b PartialKV) SumFloat64(ord uint64, key string, value float64)

func (PartialKV) SumInt64

func (b PartialKV) SumInt64(ord uint64, key string, value int64)

func (PartialKV) UpdatePolicy

func (b PartialKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy

func (PartialKV) ValueType

func (b PartialKV) ValueType() string

type PartialStore

type PartialStore interface {
	Roll(lastBlock uint64)
}

type QuickLoad added in v1.14.0

type QuickLoad interface {
	QuickLoad(ctx context.Context, atBlock bstream.BlockRef) error
	QuickLoadOpen(ctx context.Context, atBlock bstream.BlockRef) error
	QuickLoadFinish(ctx context.Context, atBlock bstream.BlockRef) error
	QuickLoadClose()
}

type QuickSave added in v1.14.0

type QuickSave interface {
	QuickSave(ctx context.Context, atBlockHash string) error
}

type Reader

type Reader interface {
	fmt.Stringer

	Named

	GetFirst(key string) ([]byte, bool)
	GetLast(key string) ([]byte, bool)
	GetAt(ord uint64, key string) ([]byte, bool)

	HasFirst(key string) bool
	HasLast(key string) bool
	HasAt(ord uint64, key string) bool
}

type Resettable

type Resettable interface {
	Reset()
}

type Savable

type Savable interface {
	Save(endBoundaryBlock uint64) (*FileInfo, *fileWriter, error)
}

type SetSumBigDecimalSetter added in v1.7.0

type SetSumBigDecimalSetter interface {
	SetSumBigDecimal(ord uint64, key string, value []byte)
}

type SetSumBigIntSetter added in v1.7.0

type SetSumBigIntSetter interface {
	SetSumBigInt(ord uint64, key string, value []byte)
}

type SetSumFloat64Setter added in v1.7.0

type SetSumFloat64Setter interface {
	SetSumFloat64(ord uint64, key string, value []byte)
}

type SetSumInt64Setter added in v1.7.0

type SetSumInt64Setter interface {
	SetSumInt64(ord uint64, key string, value []byte)
}

type Setter

type Setter interface {
	Set(name string, s Store)
}

type SumBigDecimalSetter

type SumBigDecimalSetter interface {
	SumBigDecimal(ord uint64, key string, value decimal.Decimal)
}

type SumBigIntSetter

type SumBigIntSetter interface {
	SumBigInt(ord uint64, key string, value *big.Int)
}

type SumFloat64Setter

type SumFloat64Setter interface {
	SumFloat64(ord uint64, key string, value float64)
}

type SumInt64Setter

type SumInt64Setter interface {
	SumInt64(ord uint64, key string, value int64)
}

type UpdateKeySetter

type UpdateKeySetter interface {
	Set(ord uint64, key string, value string)
	SetBytes(ord uint64, key string, value []byte)
}

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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