Documentation
¶
Index ¶
- Constants
- Variables
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func ReportStoreSizeMetrics(k Keeper, sizeDelta float32)
- type BatchingChangeManager
- type ChangeManager
- type Keeper
- func (k Keeper) AppendStorageValueAndNotify(ctx sdk.Context, path, value string) error
- func (k Keeper) EmitChange(ctx sdk.Context, change *ProposedChange)
- func (k Keeper) ExportStorage(ctx sdk.Context) []*types.DataEntry
- func (k Keeper) ExportStorageFromPrefix(ctx sdk.Context, pathPrefix string) []*types.DataEntry
- func (k Keeper) FlushChangeEvents(ctx sdk.Context)
- func (k Keeper) GetChildren(ctx sdk.Context, path string) *types.Children
- func (k Keeper) GetDataPrefix() []byte
- func (k Keeper) GetEntry(ctx sdk.Context, path string) agoric.KVEntry
- func (k Keeper) GetIntValue(ctx sdk.Context, path string) (sdkmath.Int, error)
- func (k Keeper) GetNoDataValue() []byte
- func (k Keeper) GetQueueLength(ctx sdk.Context, queuePath string) (sdkmath.Int, error)
- func (k Keeper) GetStoreName() string
- func (k Keeper) HasChildren(ctx sdk.Context, path string) bool
- func (k Keeper) HasEntry(ctx sdk.Context, path string) bool
- func (k Keeper) HasStorage(ctx sdk.Context, path string) bool
- func (k Keeper) ImportStorage(ctx sdk.Context, entries []*types.DataEntry)
- func (k Keeper) LegacySetStorageAndNotify(ctx sdk.Context, entry agoric.KVEntry)
- func (k Keeper) NewChangeBatch(ctx sdk.Context)
- func (k Keeper) PathToEncodedKey(path string) []byte
- func (k Keeper) PushQueueItem(ctx sdk.Context, queuePath string, value string) error
- func (k Keeper) RemoveEntriesWithPrefix(ctx sdk.Context, pathPrefix string)
- func (k Keeper) SetStorage(ctx sdk.Context, entry agoric.KVEntry)
- func (k Keeper) SetStorageAndNotify(ctx sdk.Context, entry agoric.KVEntry)
- type ProposedChange
- type Querier
- func (k Querier) CapData(c context.Context, req *types.QueryCapDataRequest) (*types.QueryCapDataResponse, error)
- func (k Querier) Children(c context.Context, req *types.QueryChildrenRequest) (*types.QueryChildrenResponse, error)
- func (k Querier) Data(c context.Context, req *types.QueryDataRequest) (*types.QueryDataResponse, error)
- type StreamCell
Constants ¶
const ( // Media types. JSONLines = "JSON Lines" // CapData transformation formats. FormatCapDataFlat = "flat" // CapData remotable value formats. FormatRemotableAsObject = "object" FormatRemotableAsString = "string" )
const ( QueryData = "data" QueryChildren = "children" )
query endpoints supported by the vstorage Querier
const MetricLabelStoreKey = "storeKey"
Variables ¶
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
var MetricKeyStoreSizeDecrese = []string{"store", "size_decrease"}
var MetricKeyStoreSizeIncrease = []string{"store", "size_increase"}
Functions ¶
func NewQuerier ¶
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier returns the function for handling queries routed to this module. It performs its own routing based on the first slash-separated URL path segment (e.g., URL path `/data/foo.bar` is a request for the value associated with vstorage path "foo.bar", and `/children/foo.bar` is a request for the child path segments immediately underneath vstorage path "foo.bar" which may be used to extend it to a vstorage path such as "foo.bar.baz").
func ReportStoreSizeMetrics ¶
Types ¶
type BatchingChangeManager ¶
type BatchingChangeManager struct {
// contains filtered or unexported fields
}
func NewBatchingChangeManager ¶
func NewBatchingChangeManager() *BatchingChangeManager
The BatchingChangeManager needs to be a pointer because its state is mutated.
func (*BatchingChangeManager) EmitEvents ¶
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 ¶
func (bcm *BatchingChangeManager) Rollback(ctx sdk.Context)
type ChangeManager ¶
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 storetypes.StoreKey) Keeper
func (Keeper) AppendStorageValueAndNotify ¶
func (Keeper) EmitChange ¶
func (k Keeper) EmitChange(ctx sdk.Context, change *ProposedChange)
func (Keeper) ExportStorage ¶
ExportStorage fetches all storage
func (Keeper) ExportStorageFromPrefix ¶
ExportStorageFromPrefix fetches storage only under the supplied pathPrefix.
func (Keeper) FlushChangeEvents ¶
func (Keeper) GetChildren ¶
GetChildren gets all vstorage child children at a given path
func (Keeper) GetDataPrefix ¶
func (Keeper) GetIntValue ¶
func (Keeper) GetNoDataValue ¶
func (Keeper) GetQueueLength ¶
func (Keeper) GetStoreName ¶
func (Keeper) HasChildren ¶
HasChildren tells if a given path has child children.
func (Keeper) HasStorage ¶
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 (Keeper) LegacySetStorageAndNotify ¶
func (Keeper) NewChangeBatch ¶
func (Keeper) PathToEncodedKey ¶
func (Keeper) PushQueueItem ¶
func (Keeper) RemoveEntriesWithPrefix ¶
RemoveEntriesWithPrefix removes all storage entries starting with the supplied pathPrefix, which may not be empty. It has the same effect as listing children of the prefix and removing each descendant recursively.
func (Keeper) SetStorage ¶
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
type ProposedChange ¶
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) CapData ¶
func (k Querier) CapData(c context.Context, req *types.QueryCapDataRequest) (*types.QueryCapDataResponse, error)
/agoric.vstorage.Query/CapData returns data for a specified path, interpreted as CapData in a StreamCell (auto-promoting isolated CapData into a single-item StreamCell) and transformed as specified.
func (Querier) Children ¶
func (k Querier) Children(c context.Context, req *types.QueryChildrenRequest) (*types.QueryChildrenResponse, error)
/agoric.vstorage.Query/Children returns the list of path segments that exist immediately underneath a specified path, including those corresponding with "empty non-terminals" having children but no data of their own.
func (Querier) Data ¶
func (k Querier) Data(c context.Context, req *types.QueryDataRequest) (*types.QueryDataResponse, error)
/agoric.vstorage.Query/Data returns data for a specified path.
type StreamCell ¶
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, but we do not enforce that in this package.