state

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 19 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 BuilderOption

type BuilderOption func(b *Store)

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 Info

type Info struct {
	LastKVFile        string `json:"last_kv_file"`
	LastKVSavedBlock  uint64 `json:"last_saved_block"`
	RangeIntervalSize uint64 `json:"range_interval_size"`
}

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 Store

type Store struct {
	Name         string
	Store        dstore.Store
	SaveInterval uint64
	Initialized  bool

	ModuleInitialBlock uint64
	StoreInitialBlock  uint64 // block at which we initialized this store
	ProcessedBlock     uint64

	ModuleHash string

	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 NewBuilder

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

func (*Store) ApplyDelta

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

func (*Store) CloneStructure

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

func (*Store) Del

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

func (*Store) DeletePrefix

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

func (*Store) DeleteStore

func (b *Store) DeleteStore(ctx context.Context, exclusiveEndBlock uint64) error

func (*Store) Fetch

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

func (*Store) Flush

func (b *Store) Flush()

func (*Store) GetAt

func (b *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 (b *Store) GetFirst(key string) ([]byte, bool)

func (*Store) GetLast

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

func (*Store) Info

func (b *Store) Info(ctx context.Context) (*Info, error)

func (*Store) IsPartial

func (s *Store) IsPartial() bool

func (*Store) LoadFrom

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

func (*Store) MarshalLogObject

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

func (*Store) Merge

func (into *Store) Merge(builder *Store) error

func (*Store) Print

func (b *Store) Print()

func (*Store) PrintDelta

func (b *Store) PrintDelta(delta *pbsubstreams.StoreDelta)

func (*Store) Roll

func (b *Store) Roll(lastBlock uint64)

func (*Store) Set

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

func (*Store) SetBytes

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

func (*Store) SetBytesIfNotExists

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

func (*Store) SetIfNotExists

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

func (*Store) SetMaxBigFloat

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

func (*Store) SetMaxBigInt

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

func (*Store) SetMaxFloat64

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

func (*Store) SetMaxInt64

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

func (*Store) SetMinBigFloat

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

func (*Store) SetMinBigInt

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

func (*Store) SetMinFloat64

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

func (*Store) SetMinInt64

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

func (*Store) SumBigFloat

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

func (*Store) SumBigInt

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

func (*Store) SumFloat64

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

func (*Store) SumInt64

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

func (*Store) Truncate

func (b *Store) Truncate()

func (*Store) WriteState

func (b *Store) WriteState(ctx context.Context, lastBlock uint64) (err error)

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