store

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFound = errors.New("store not found")

Functions

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, traceID string) string

Types

type Appender

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

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,
	traceID string,
) (*Config, 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, below 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 dstore.Store, storeModules []*pbsubstreams.Module, moduleHashes *manifest.ModuleHashes, traceID string) (out ConfigMap, err error)

type Deleter

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

type DeltaAccessor

type DeltaAccessor interface {
	SetDeltas([]*pbssinternal.StoreDelta)
	GetDeltas() []*pbssinternal.StoreDelta
	ApplyDeltasReverse(deltas []*pbssinternal.StoreDelta)
	ApplyDelta(delta *pbssinternal.StoreDelta)
}

type FileInfo

type FileInfo struct {
	Filename string
	Range    *block.Range
	TraceID  string
	Partial  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(moduleInitialBlock uint64, exlusiveEnd uint64) *FileInfo

func NewPartialFileInfo added in v1.1.3

func NewPartialFileInfo(start uint64, exlusiveEnd uint64, traceID string) *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) error

func (FullKV) ApplyDelta

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

func (FullKV) ApplyDeltasReverse

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

func (FullKV) DeletePrefix

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

func (*FullKV) DerivePartialStore

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

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() []*pbssinternal.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) 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) Reset

func (s *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.

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 []*pbssinternal.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) 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 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) 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 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 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) error

func (PartialKV) ApplyDelta

func (b PartialKV) ApplyDelta(delta *pbssinternal.StoreDelta)

func (PartialKV) ApplyDeltasReverse

func (b PartialKV) ApplyDeltasReverse(deltas []*pbssinternal.StoreDelta)

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) 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() []*pbssinternal.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) 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 []*pbssinternal.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) 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 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 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 TraceIDParam added in v1.1.3

type TraceIDParam string

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