state

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputValueTypeInt64    = "int64"
	OutputValueTypeFloat64  = "float64"
	OutputValueTypeBigInt   = "bigint"
	OutputValueTypeBigFloat = "bigfloat"
	OutputValueTypeString   = "string"
)

Variables

This section is empty.

Functions

func FullStateFileName

func FullStateFileName(r *block.Range, moduleStartBlock uint64) string

func FullStateFilePrefix

func FullStateFilePrefix(blockNum uint64) string

func InfoFileName

func InfoFileName() string

func PartialFileName

func PartialFileName(r *block.Range) string

Types

type ConditionalKeySetter

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

type Deleter

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

type FileInfo

type FileInfo struct {
	StartBlock uint64
	EndBlock   uint64
	Partial    bool
}

func ParseFileName

func ParseFileName(filename string) (*FileInfo, bool)

type MaxBigFloatSetter

type MaxBigFloatSetter interface {
	SetMaxBigFloat(ord uint64, key string, value *big.Float)
}

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 {
	Merge(other *Store) error
}

type MinBigFloatSetter

type MinBigFloatSetter interface {
	SetMinBigFloat(ord uint64, key string, value *big.Float)
}

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 Reader

type Reader interface {
	GetFirst(key string) ([]byte, bool)
	GetLast(key string) ([]byte, bool)
	GetAt(ord uint64, key string) ([]byte, bool)
}

type Snapshot added in v0.0.14

type Snapshot struct {
	block.Range
	Path string
}

type Snapshots added in v0.0.14

type Snapshots struct {
	Completes block.Ranges // Shortest completes first, largest last.
	Partials  block.Ranges // First partials first, last last
}

func (*Snapshots) ContainsPartial added in v0.0.14

func (s *Snapshots) ContainsPartial(r *block.Range) bool

func (*Snapshots) LastCompletedBlock added in v0.0.14

func (s *Snapshots) LastCompletedBlock() uint64

func (*Snapshots) Sort added in v0.0.14

func (s *Snapshots) Sort()

type Store

type Store struct {
	Name         string
	ModuleHash   string
	Store        dstore.Store
	SaveInterval uint64

	ModuleInitialBlock uint64

	KV              map[string][]byte          // KV is the state, and assumes all Deltas were already applied to it.
	Deltas          []*pbsubstreams.StoreDelta // Deltas are always deltas for the given block.
	DeletedPrefixes []string

	UpdatePolicy pbsubstreams.Module_KindStore_UpdatePolicy
	ValueType    string
	// contains filtered or unexported fields
}

func NewStore added in v0.0.19

func NewStore(name string, saveInterval uint64, moduleInitialBlock uint64, moduleHash string, updatePolicy pbsubstreams.Module_KindStore_UpdatePolicy, valueType string, store dstore.Store) (*Store, error)

func (*Store) Append added in v0.0.14

func (s *Store) Append(ord uint64, key string, value []byte)

func (*Store) ApplyDelta

func (s *Store) ApplyDelta(delta *pbsubstreams.StoreDelta)

func (*Store) ApplyDeltaReverse added in v0.0.20

func (s *Store) ApplyDeltaReverse(deltas []*pbsubstreams.StoreDelta)

func (*Store) CloneStructure

func (s *Store) CloneStructure(newStoreStartBlock uint64) *Store

func (*Store) Del

func (s *Store) Del(ord uint64, key string)

func (*Store) DeletePrefix

func (s *Store) DeletePrefix(ord uint64, prefix string)

func (*Store) DeleteStore

func (s *Store) DeleteStore(ctx context.Context, exclusiveEndBlock uint64) *storeDeleter

func (*Store) Fetch

func (s *Store) Fetch(ctx context.Context, exclusiveEndBlock uint64) error

func (*Store) Flush

func (s *Store) Flush()

func (*Store) GetAt

func (s *Store) GetAt(ord uint64, key string) (out []byte, found bool)

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

func (*Store) GetFirst

func (s *Store) GetFirst(key string) ([]byte, bool)

func (*Store) GetLast

func (s *Store) GetLast(key string) ([]byte, bool)

func (*Store) IsPartial

func (s *Store) IsPartial() bool

func (*Store) ListSnapshots added in v0.0.14

func (s *Store) ListSnapshots(ctx context.Context) (out *Snapshots, err error)

func (*Store) LoadFrom

func (s *Store) LoadFrom(ctx context.Context, blockRange *block.Range) (*Store, error)

func (*Store) MarshalLogObject

func (s *Store) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*Store) Merge

func (s *Store) Merge(nextStore *Store) error

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

func (*Store) Roll

func (s *Store) Roll(lastBlock uint64)

func (*Store) Set

func (s *Store) Set(ord uint64, key string, value string)

func (*Store) SetBytes

func (s *Store) SetBytes(ord uint64, key string, value []byte)

func (*Store) SetBytesIfNotExists

func (s *Store) SetBytesIfNotExists(ord uint64, key string, value []byte)

func (*Store) SetIfNotExists

func (s *Store) SetIfNotExists(ord uint64, key string, value string)

func (*Store) SetMaxBigFloat

func (s *Store) SetMaxBigFloat(ord uint64, key string, value *big.Float)

func (*Store) SetMaxBigInt

func (s *Store) SetMaxBigInt(ord uint64, key string, value *big.Int)

func (*Store) SetMaxFloat64

func (s *Store) SetMaxFloat64(ord uint64, key string, value float64)

func (*Store) SetMaxInt64

func (s *Store) SetMaxInt64(ord uint64, key string, value int64)

func (*Store) SetMinBigFloat

func (s *Store) SetMinBigFloat(ord uint64, key string, value *big.Float)

func (*Store) SetMinBigInt

func (s *Store) SetMinBigInt(ord uint64, key string, value *big.Int)

func (*Store) SetMinFloat64

func (s *Store) SetMinFloat64(ord uint64, key string, value float64)

func (*Store) SetMinInt64

func (s *Store) SetMinInt64(ord uint64, key string, value int64)

func (*Store) StoreInitialBlock

func (s *Store) StoreInitialBlock() uint64

func (*Store) SumBigFloat

func (s *Store) SumBigFloat(ord uint64, key string, value *big.Float)

func (*Store) SumBigInt

func (s *Store) SumBigInt(ord uint64, key string, value *big.Int)

func (*Store) SumFloat64

func (s *Store) SumFloat64(ord uint64, key string, value float64)

func (*Store) SumInt64

func (s *Store) SumInt64(ord uint64, key string, value int64)

func (*Store) WriteState

func (s *Store) WriteState(ctx context.Context, endBoundaryBlock uint64) (*storeWriter, error)

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

type SumBigFloatSetter

type SumBigFloatSetter interface {
	SumBigFloat(ord uint64, key string, value *big.Float)
}

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)
}

Jump to

Keyboard shortcuts

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