Documentation
¶
Index ¶
- Variables
- func FilenamePrefix(blockNum uint64) string
- func FullStateFileName(r *block.Range) string
- func PartialFileName(r *block.Range) string
- func SetMetadataDetached(metaStore dstore.Store, filename, storeName string, metadata map[string]string, ...)
- type Appender
- type ConditionalKeySetter
- type Config
- func (c *Config) ExistsFullKV(ctx context.Context, upTo uint64) (bool, error)
- func (c *Config) ExistsPartialKV(ctx context.Context, from, to uint64) (bool, error)
- func (c *Config) FileSize(ctx context.Context, fileInfo *FileInfo) (int64, error)
- func (c *Config) ListSnapshotFiles(ctx context.Context, from uint64, inclusiveTo *uint64) (files []*FileInfo, err error)
- func (c *Config) ModuleHash() string
- func (c *Config) ModuleInitialBlock() uint64
- func (c *Config) Name() string
- func (c *Config) NewFullKV(logger *zap.Logger) *FullKV
- func (c *Config) NewPartialKV(initialBlock uint64, logger *zap.Logger) *PartialKV
- func (c *Config) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
- func (c *Config) ValueType() string
- type ConfigMap
- type DeletedPrefixes
- type Deleter
- type DeltaAccessor
- type FileInfo
- func CompleteFile(in string, params ...FileInfoParam) *FileInfo
- func NewCompleteFileInfo(moduleName string, moduleInitialBlock uint64, exclusiveEndBlock uint64) *FileInfo
- func NewPartialFileInfo(moduleName string, start uint64, exclusiveEndBlock uint64) *FileInfo
- func PartialFile(in string, params ...FileInfoParam) *FileInfo
- type FileInfoParam
- type FileInfos
- type FullKV
- func (b FullKV) Append(ord uint64, key string, value []byte)
- func (b FullKV) ApplyDelta(delta *pbsubstreams.StoreDelta)
- func (b FullKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)
- func (b FullKV) ApplyOps(in []byte) error
- func (b FullKV) Close() error
- func (s *FullKV) Delete(ctx context.Context, file *FileInfo) error
- func (b FullKV) DeletePrefix(ord uint64, prefix string)
- func (s *FullKV) DerivePartialStore(initialBlock uint64) *PartialKV
- func (s *FullKV) Filename() string
- func (b FullKV) Flush() (err error)
- func (b FullKV) GetAt(ord uint64, key string) (out []byte, found bool)
- func (b FullKV) GetDeltas() []*pbsubstreams.StoreDelta
- func (b FullKV) GetFirst(key string) ([]byte, bool)
- func (b FullKV) GetLast(key string) ([]byte, bool)
- func (s *FullKV) GetSize(ctx context.Context, filename string) (compressedSize uint64, uncompressedSize *uint64, metadata map[string]string, ...)
- func (b FullKV) HasAt(ord uint64, key string) bool
- func (b FullKV) HasFirst(key string) bool
- func (b FullKV) HasLast(key string) bool
- func (b FullKV) InitialBlock() uint64
- func (b FullKV) Iter(f func(key string, value []byte) error) error
- func (b FullKV) Length() uint64
- func (s *FullKV) Load(ctx context.Context, file *FileInfo) error
- func (b FullKV) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (s *FullKV) Marshaller() marshaller.Marshaller
- func (b FullKV) Merge(kvPartialStore *PartialKV) error
- func (b FullKV) Name() string
- func (s *FullKV) QuickLoad(ctx context.Context, atBlock bstream.BlockRef) error
- func (s *FullKV) QuickLoadClose()
- func (s *FullKV) QuickLoadFinish(ctx context.Context, atBlock bstream.BlockRef) error
- func (s *FullKV) QuickLoadOpen(ctx context.Context, atBlock bstream.BlockRef) error
- func (s *FullKV) QuickSave(ctx context.Context, atBlockHash string) error
- func (b FullKV) ReadOps() []byte
- func (b FullKV) Reset()
- func (s *FullKV) Save(endBoundaryBlock uint64) (*FileInfo, *fileWriter, error)
- func (b FullKV) Set(ord uint64, key string, value string)
- func (b FullKV) SetBytes(ord uint64, key string, value []byte)
- func (b FullKV) SetBytesIfNotExists(ord uint64, key string, value []byte)
- func (b FullKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)
- func (b FullKV) SetIfNotExists(ord uint64, key string, value string)
- func (b FullKV) SetMaxBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b FullKV) SetMaxBigInt(ord uint64, key string, value *big.Int)
- func (b FullKV) SetMaxFloat64(ord uint64, key string, value float64)
- func (b FullKV) SetMaxInt64(ord uint64, key string, value int64)
- func (b FullKV) SetMinBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b FullKV) SetMinBigInt(ord uint64, key string, value *big.Int)
- func (b FullKV) SetMinFloat64(ord uint64, key string, value float64)
- func (b FullKV) SetMinInt64(ord uint64, key string, value int64)
- func (b FullKV) SetSumBigDecimal(ord uint64, key string, value []byte)
- func (b FullKV) SetSumBigInt(ord uint64, key string, value []byte)
- func (b FullKV) SetSumFloat64(ord uint64, key string, value []byte)
- func (b FullKV) SetSumInt64(ord uint64, key string, value []byte)
- func (b FullKV) SizeBytes() uint64
- func (s *FullKV) Store() dstore.Store
- func (s *FullKV) String() string
- func (b FullKV) SumBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b FullKV) SumBigInt(ord uint64, key string, value *big.Int)
- func (b FullKV) SumFloat64(ord uint64, key string, value float64)
- func (b FullKV) SumInt64(ord uint64, key string, value int64)
- func (b FullKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
- func (b FullKV) ValueType() string
- type Getter
- type Iterable
- type KVImpl
- type KVImplBackendConfig
- type KVImplConfig
- type KVImplType
- type Loadable
- type Map
- func (m Map) All() map[string]Store
- func (m Map) Get(name string) (Store, bool)
- func (m Map) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (m Map) Names() []string
- func (m *Map) QuickLoad(ctx context.Context, atBlock bstream.BlockRef) error
- func (m *Map) QuickLoadClose()
- func (m *Map) QuickLoadFinish(ctx context.Context, atBlock bstream.BlockRef) error
- func (m *Map) QuickLoadOpen(ctx context.Context, atBlock bstream.BlockRef) error
- func (m *Map) QuickSave(ctx context.Context, atBlockHash string) error
- func (m Map) Set(s Store)
- type MaxBigDecimalSetter
- type MaxBigIntSetter
- type MaxFloat64Setter
- type MaxInt64Setter
- type MemoryBackendConfig
- type Mergeable
- type MinBigDecimalSetter
- type MinBigIntSetter
- type MinFloat64Setter
- type MinInt64Setter
- type MmapBackendConfig
- type Named
- type PartialKV
- func (b PartialKV) Append(ord uint64, key string, value []byte)
- func (p *PartialKV) ApplyDelta(delta *pbsubstreams.StoreDelta)
- func (p *PartialKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)
- func (b PartialKV) ApplyOps(in []byte) error
- func (b PartialKV) Close() error
- func (p *PartialKV) DeletePrefix(ord uint64, prefix string)
- func (p *PartialKV) DeleteStore(ctx context.Context, file *FileInfo) (err error)
- func (b PartialKV) Flush() (err error)
- func (b PartialKV) GetAt(ord uint64, key string) (out []byte, found bool)
- func (b PartialKV) GetDeltas() []*pbsubstreams.StoreDelta
- func (b PartialKV) GetFirst(key string) ([]byte, bool)
- func (b PartialKV) GetLast(key string) ([]byte, bool)
- func (b PartialKV) HasAt(ord uint64, key string) bool
- func (b PartialKV) HasFirst(key string) bool
- func (b PartialKV) HasLast(key string) bool
- func (p *PartialKV) InitialBlock() uint64
- func (b PartialKV) Iter(f func(key string, value []byte) error) error
- func (b PartialKV) Length() uint64
- func (p *PartialKV) Load(ctx context.Context, file *FileInfo) error
- func (b PartialKV) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (b PartialKV) Merge(kvPartialStore *PartialKV) error
- func (b PartialKV) Name() string
- func (b PartialKV) ReadOps() []byte
- func (b PartialKV) Reset()
- func (p *PartialKV) Roll(lastBlock uint64)
- func (p *PartialKV) Save(endBoundaryBlock uint64) (*FileInfo, *fileWriter, error)
- func (b PartialKV) Set(ord uint64, key string, value string)
- func (b PartialKV) SetBytes(ord uint64, key string, value []byte)
- func (b PartialKV) SetBytesIfNotExists(ord uint64, key string, value []byte)
- func (b PartialKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)
- func (b PartialKV) SetIfNotExists(ord uint64, key string, value string)
- func (b PartialKV) SetMaxBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b PartialKV) SetMaxBigInt(ord uint64, key string, value *big.Int)
- func (b PartialKV) SetMaxFloat64(ord uint64, key string, value float64)
- func (b PartialKV) SetMaxInt64(ord uint64, key string, value int64)
- func (b PartialKV) SetMinBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b PartialKV) SetMinBigInt(ord uint64, key string, value *big.Int)
- func (b PartialKV) SetMinFloat64(ord uint64, key string, value float64)
- func (b PartialKV) SetMinInt64(ord uint64, key string, value int64)
- func (b PartialKV) SetSumBigDecimal(ord uint64, key string, value []byte)
- func (b PartialKV) SetSumBigInt(ord uint64, key string, value []byte)
- func (b PartialKV) SetSumFloat64(ord uint64, key string, value []byte)
- func (b PartialKV) SetSumInt64(ord uint64, key string, value []byte)
- func (b PartialKV) SizeBytes() uint64
- func (p *PartialKV) String() string
- func (b PartialKV) SumBigDecimal(ord uint64, key string, value decimal.Decimal)
- func (b PartialKV) SumBigInt(ord uint64, key string, value *big.Int)
- func (b PartialKV) SumFloat64(ord uint64, key string, value float64)
- func (b PartialKV) SumInt64(ord uint64, key string, value int64)
- func (b PartialKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
- func (b PartialKV) ValueType() string
- type PartialStore
- type QuickLoad
- type QuickSave
- type Reader
- type Resettable
- type Savable
- type SetSumBigDecimalSetter
- type SetSumBigIntSetter
- type SetSumFloat64Setter
- type SetSumInt64Setter
- type Setter
- type Store
- type SumBigDecimalSetter
- type SumBigIntSetter
- type SumFloat64Setter
- type SumInt64Setter
- type UpdateKeySetter
Constants ¶
This section is empty.
Variables ¶
var DefaultStoreSizeLimit uint64 = 1_073_741_824 // 1GiB
var ErrInvalidFullKVFile = errors.New("unmarshal store error") // this error will bubble up to the user
var ErrNoQuickSaveStore = fmt.Errorf("no quick save store")
var ErrNotFound = errors.New("store not found")
var ErrStoreAboveMaxSize = errors.New("store above max size")
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).
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 FullStateFileName ¶ added in v1.1.3
func PartialFileName ¶ added in v1.1.3
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 ConditionalKeySetter ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) ExistsFullKV ¶ added in v1.4.0
func (*Config) ExistsPartialKV ¶ added in v1.4.0
func (*Config) ListSnapshotFiles ¶
func (*Config) ModuleHash ¶
func (*Config) ModuleInitialBlock ¶
func (*Config) NewPartialKV ¶
func (*Config) UpdatePolicy ¶
func (c *Config) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
type ConfigMap ¶
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 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 NewPartialFileInfo ¶ added in v1.1.3
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.
type FullKV ¶
type FullKV struct {
// contains filtered or unexported fields
}
func (FullKV) ApplyDelta ¶
func (b FullKV) ApplyDelta(delta *pbsubstreams.StoreDelta)
func (FullKV) ApplyDeltasReverse ¶
func (b FullKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)
func (FullKV) DeletePrefix ¶
func (*FullKV) DerivePartialStore ¶
func (FullKV) GetDeltas ¶
func (b FullKV) GetDeltas() []*pbsubstreams.StoreDelta
func (FullKV) HasAt ¶ added in v1.0.0
HasAt returns true if the key exists for the state that includes the processing of `ord`.
func (FullKV) InitialBlock ¶
func (b FullKV) InitialBlock() uint64
func (FullKV) MarshalLogObject ¶
func (b FullKV) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (*FullKV) Marshaller ¶
func (s *FullKV) Marshaller() marshaller.Marshaller
func (FullKV) Merge ¶
Merge nextStore _into_ `s`, where nextStore is for the next contiguous segment's store output.
func (*FullKV) QuickLoad ¶ added in v1.14.0
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
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
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) Save ¶
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) SetBytesIfNotExists ¶
func (FullKV) SetDeltas ¶
func (b FullKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)
func (FullKV) SetIfNotExists ¶
func (FullKV) SetMaxBigDecimal ¶
func (FullKV) SetMaxFloat64 ¶
func (FullKV) SetMaxInt64 ¶
func (FullKV) SetMinBigDecimal ¶
func (FullKV) SetMinFloat64 ¶
func (FullKV) SetMinInt64 ¶
func (FullKV) SetSumBigDecimal ¶ added in v1.7.0
func (FullKV) SetSumBigInt ¶ added in v1.7.0
func (FullKV) SetSumFloat64 ¶ added in v1.7.0
func (FullKV) SetSumInt64 ¶ added in v1.7.0
func (FullKV) SumBigDecimal ¶
func (FullKV) SumFloat64 ¶
func (FullKV) UpdatePolicy ¶
func (b FullKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
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.
type KVImplType ¶ added in v1.20.0
type KVImplType string
KVImplType specifies the storage implementation
const ( KVImplTypeMmap KVImplType = "mmap" KVImplTypeMemory KVImplType = "memory" )
type Map ¶
func (Map) MarshalLogObject ¶
func (m Map) MarshalLogObject(enc zapcore.ObjectEncoder) 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
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
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).
type MaxBigDecimalSetter ¶
type MaxBigIntSetter ¶
type MaxFloat64Setter ¶
type MaxInt64Setter ¶
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 MinBigIntSetter ¶
type MinFloat64Setter ¶
type MinInt64Setter ¶
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 PartialKV ¶
type PartialKV struct {
DeletedPrefixes []string
// contains filtered or unexported fields
}
func (*PartialKV) ApplyDelta ¶
func (p *PartialKV) ApplyDelta(delta *pbsubstreams.StoreDelta)
func (*PartialKV) ApplyDeltasReverse ¶
func (p *PartialKV) ApplyDeltasReverse(deltas []*pbsubstreams.StoreDelta)
func (*PartialKV) DeletePrefix ¶
func (*PartialKV) DeleteStore ¶
func (PartialKV) GetDeltas ¶
func (b PartialKV) GetDeltas() []*pbsubstreams.StoreDelta
func (PartialKV) HasAt ¶ added in v1.0.0
HasAt returns true if the key exists for the state that includes the processing of `ord`.
func (*PartialKV) InitialBlock ¶
func (PartialKV) MarshalLogObject ¶
func (b PartialKV) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (PartialKV) Merge ¶
Merge nextStore _into_ `s`, where nextStore is for the next contiguous segment's store output.
func (PartialKV) SetBytesIfNotExists ¶
func (PartialKV) SetDeltas ¶
func (b PartialKV) SetDeltas(deltas []*pbsubstreams.StoreDelta)
func (PartialKV) SetIfNotExists ¶
func (PartialKV) SetMaxBigDecimal ¶
func (PartialKV) SetMaxBigInt ¶
func (PartialKV) SetMaxFloat64 ¶
func (PartialKV) SetMaxInt64 ¶
func (PartialKV) SetMinBigDecimal ¶
func (PartialKV) SetMinBigInt ¶
func (PartialKV) SetMinFloat64 ¶
func (PartialKV) SetMinInt64 ¶
func (PartialKV) SetSumBigDecimal ¶ added in v1.7.0
func (PartialKV) SetSumBigInt ¶ added in v1.7.0
func (PartialKV) SetSumFloat64 ¶ added in v1.7.0
func (PartialKV) SetSumInt64 ¶ added in v1.7.0
func (PartialKV) SumBigDecimal ¶
func (PartialKV) SumFloat64 ¶
func (PartialKV) UpdatePolicy ¶
func (b PartialKV) UpdatePolicy() pbsubstreams.Module_KindStore_UpdatePolicy
type PartialStore ¶
type PartialStore interface {
Roll(lastBlock uint64)
}
type Resettable ¶
type Resettable interface {
Reset()
}
type SetSumBigDecimalSetter ¶ added in v1.7.0
type SetSumBigIntSetter ¶ added in v1.7.0
type SetSumFloat64Setter ¶ added in v1.7.0
type SetSumInt64Setter ¶ added in v1.7.0
type Store ¶
type Store interface {
Name() string
InitialBlock() uint64
SizeBytes() uint64
Flush() error
Loadable
Savable
Iterable
DeltaAccessor
Resettable
Mergeable
Named
// intrinsics
Reader
UpdateKeySetter
ConditionalKeySetter
Appender
Deleter
MaxBigIntSetter
MaxInt64Setter
MaxFloat64Setter
MaxBigDecimalSetter
MinBigIntSetter
MinInt64Setter
MinFloat64Setter
MinBigDecimalSetter
SumBigIntSetter
SumInt64Setter
SumFloat64Setter
SumBigDecimalSetter
SetSumInt64Setter
SetSumFloat64Setter
SetSumBigIntSetter
SetSumBigDecimalSetter
}
type SumBigDecimalSetter ¶
type SumBigIntSetter ¶
type SumFloat64Setter ¶
type SumInt64Setter ¶
Source Files
¶
- base_store.go
- common.go
- config.go
- configmap.go
- delta.go
- filename.go
- full_kv.go
- interface.go
- iterable.go
- kv_impl.go
- kv_impl_config.go
- kv_impl_memory.go
- kv_impl_mmap.go
- logging.go
- map.go
- merge.go
- partial_kv.go
- store_max.go
- store_min.go
- store_setsum.go
- store_sum.go
- testing.go
- value_append.go
- value_delete.go
- value_get.go
- value_set.go
- writer.go