keeper

package
v0.34.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	QueryData     = "data"
	QueryChildren = "children"
)

query endpoints supported by the vstorage Querier

Variables

View Source
var MaxSDKInt = sdk.NewIntFromBigInt(new(big.Int).Sub(new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1)))

2 ** 256 - 1

Functions

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

Types

type BatchingChangeManager added in v0.34.0

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

func NewBatchingChangeManager added in v0.34.0

func NewBatchingChangeManager() *BatchingChangeManager

The BatchingChangeManager needs to be a pointer because its state is mutated.

func (*BatchingChangeManager) EmitEvents added in v0.34.0

func (bcm *BatchingChangeManager) EmitEvents(ctx sdk.Context, k Keeper)

EmitEvents emits events for all actual changes. This does not clear the cache, so the caller must call Rollback() to do so.

func (*BatchingChangeManager) Rollback added in v0.34.0

func (bcm *BatchingChangeManager) Rollback(ctx sdk.Context)

func (*BatchingChangeManager) Track added in v0.34.0

func (bcm *BatchingChangeManager) Track(ctx sdk.Context, k Keeper, entry types.StorageEntry, isLegacy bool)

type ChangeManager added in v0.34.0

type ChangeManager interface {
	Track(ctx sdk.Context, k Keeper, entry types.StorageEntry, isLegacy bool)
	EmitEvents(ctx sdk.Context, k Keeper)
	Rollback(ctx sdk.Context)
}

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(storeKey sdk.StoreKey) Keeper

func (Keeper) AppendStorageValueAndNotify

func (k Keeper) AppendStorageValueAndNotify(ctx sdk.Context, path, value string) error

func (Keeper) EmitChange added in v0.34.0

func (k Keeper) EmitChange(ctx sdk.Context, change *ProposedChange)

func (Keeper) ExportStorage

func (k Keeper) ExportStorage(ctx sdk.Context) []*types.DataEntry

ExportStorage fetches all storage

func (Keeper) ExportStorageFromPrefix added in v0.34.0

func (k Keeper) ExportStorageFromPrefix(ctx sdk.Context, pathPrefix string) []*types.DataEntry

ExportStorageFromPrefix fetches storage only under the supplied pathPrefix.

func (Keeper) FlushChangeEvents added in v0.34.0

func (k Keeper) FlushChangeEvents(ctx sdk.Context)

func (Keeper) GetChildren

func (k Keeper) GetChildren(ctx sdk.Context, path string) *types.Children

GetChildren gets all vstorage child children at a given path

func (Keeper) GetDataPrefix

func (k Keeper) GetDataPrefix() []byte

func (Keeper) GetEntry added in v0.34.0

func (k Keeper) GetEntry(ctx sdk.Context, path string) types.StorageEntry

GetEntry gets generic storage. The default value is an empty string.

func (Keeper) GetNoDataValue added in v0.34.0

func (k Keeper) GetNoDataValue() []byte

func (Keeper) GetQueueLength added in v0.34.0

func (k Keeper) GetQueueLength(ctx sdk.Context, queuePath string) (sdk.Int, error)

func (Keeper) GetStoreName

func (k Keeper) GetStoreName() string

func (Keeper) HasChildren

func (k Keeper) HasChildren(ctx sdk.Context, path string) bool

HasChildren tells if a given path has child children.

func (Keeper) HasEntry

func (k Keeper) HasEntry(ctx sdk.Context, path string) bool

HasEntry tells if a given path has either subnodes or data.

func (Keeper) HasStorage

func (k Keeper) HasStorage(ctx sdk.Context, path string) bool

HasStorage tells if a given path has data. Some storage nodes have no data (just an empty string) and exist only to provide linkage to subnodes with data.

func (Keeper) ImportStorage

func (k Keeper) ImportStorage(ctx sdk.Context, entries []*types.DataEntry)

func (Keeper) LegacySetStorageAndNotify

func (k Keeper) LegacySetStorageAndNotify(ctx sdk.Context, entry types.StorageEntry)

func (Keeper) MigrateNoDataPlaceholders added in v0.34.0

func (k Keeper) MigrateNoDataPlaceholders(ctx sdk.Context)

func (Keeper) NewChangeBatch added in v0.34.0

func (k Keeper) NewChangeBatch(ctx sdk.Context)

func (Keeper) PathToEncodedKey

func (k Keeper) PathToEncodedKey(path string) []byte

func (Keeper) PushQueueItem added in v0.34.0

func (k Keeper) PushQueueItem(ctx sdk.Context, queuePath string, value string) error

func (Keeper) SetStorage

func (k Keeper) SetStorage(ctx sdk.Context, entry types.StorageEntry)

SetStorage sets the data value for a path.

Maintains the invariant: path entries exist if and only if self or some descendant has non-empty storage

func (Keeper) SetStorageAndNotify

func (k Keeper) SetStorageAndNotify(ctx sdk.Context, entry types.StorageEntry)

type ProposedChange added in v0.34.0

type ProposedChange struct {
	Path               string
	ValueFromLastBlock string
	NewValue           string
	LegacyEvents       bool
}

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper

func (Querier) Data

type StreamCell

type StreamCell struct {
	BlockHeight string   `json:"blockHeight"`
	Values      []string `json:"values"`
}

StreamCell is an envelope representing a sequence of values written at a path in a single block. It is persisted to storage as a { "blockHeight": "<digits>", "values": ["...", ...] } JSON text that off-chain consumers rely upon. Many of those consumers *also* rely upon the strings of "values" being valid JSON text (cf. scripts/get-flattened-publication.sh), but we do not enforce that in this package.

Jump to

Keyboard shortcuts

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