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: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StoragePathActionQueue         = "actionQueue"
	StoragePathHighPriorityQueue   = "highPriorityQueue"
	StoragePathHighPrioritySenders = "highPrioritySenders"
	StoragePathBeansOwing          = "beansOwing"
	StoragePathEgress              = "egress"
	StoragePathMailbox             = "mailbox"
	StoragePathCustom              = "published"
	StoragePathBundles             = "bundles"
	StoragePathSwingStore          = "swingStore"
)

Top-level paths for chain storage should remain synchronized with packages/internal/src/chain-storage-paths.js

View Source
const (
	QueryEgress        = "egress"
	QueryMailbox       = "mailbox"
	LegacyQueryStorage = "storage"
	LegacyQueryKeys    = "keys"
)

query endpoints supported by the swingset Querier

View Source
const ExportDataFilename = "export-data.jsonl"
View Source
const ExportManifestFilename = "export-manifest.json"

The manifest filename must be synchronized with the JS export/import tooling

View Source
const ExportedFilesMode = 0644
View Source
const SnapshotFormat = 1

SnapshotFormat 1 is a proto message containing an artifact name, and the binary artifact data

View Source
const UntrustedExportDataArtifactName = "UNTRUSTED-EXPORT-DATA"
View Source
const UntrustedExportDataFilename = "untrusted-export-data.jsonl"

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.

func NewQuerier

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

NewQuerier is the module level router for state queries

Types

type Keeper

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

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
	accountKeeper types.AccountKeeper, bankKeeper bankkeeper.Keeper,
	vstorageKeeper vstoragekeeper.Keeper, feeCollectorName string,
	callToController func(ctx sdk.Context, str string) (string, error),
) Keeper

NewKeeper creates a new IBC transfer Keeper instance

func (Keeper) BlockingSend

func (k Keeper) BlockingSend(ctx sdk.Context, action vm.Jsonable) (string, error)

BlockingSend sends a message to the controller and blocks the Golang process until the response. It is orthogonal to PushAction, and should only be used by SwingSet to perform block lifecycle events (BEGIN_BLOCK, END_BLOCK, COMMIT_BLOCK).

func (Keeper) ChargeBeans

func (k Keeper) ChargeBeans(ctx sdk.Context, addr sdk.AccAddress, beans sdk.Uint) error

ChargeBeans charges the given address the given number of beans. It divides the beans into the number to debit immediately vs. the number to store in the beansOwing.

func (Keeper) ChargeForProvisioning added in v0.31.0

func (k Keeper) ChargeForProvisioning(ctx sdk.Context, submitter, addr sdk.AccAddress, powerFlags []string) error

func (Keeper) CoreEvalProposal

func (k Keeper) CoreEvalProposal(ctx sdk.Context, p *types.CoreEvalProposal) error

CoreEvalProposal tells SwingSet to evaluate the given JS code.

func (Keeper) ExportSwingStore added in v0.34.0

func (k Keeper) ExportSwingStore(ctx sdk.Context) []*vstoragetypes.DataEntry

func (Keeper) GetBeansOwing

func (k Keeper) GetBeansOwing(ctx sdk.Context, addr sdk.AccAddress) sdk.Uint

GetBeansOwing returns the number of beans that the given address owes to the FeeAccount but has not yet paid.

func (Keeper) GetBeansPerUnit

func (k Keeper) GetBeansPerUnit(ctx sdk.Context) map[string]sdk.Uint

GetBeansPerUnit returns a map taken from the current SwingSet parameters from a unit (key) string to an unsigned integer amount of beans.

func (Keeper) GetEgress

func (k Keeper) GetEgress(ctx sdk.Context, addr sdk.AccAddress) types.Egress

GetEgress gets the entire egress struct for a peer

func (Keeper) GetMailbox

func (k Keeper) GetMailbox(ctx sdk.Context, peer string) string

GetMailbox gets the entire mailbox struct for a peer

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

func (Keeper) GetState added in v0.32.0

func (k Keeper) GetState(ctx sdk.Context) types.State

func (Keeper) GetStoreName added in v0.31.0

func (k Keeper) GetStoreName() string

func (Keeper) InboundQueueLength added in v0.34.0

func (k Keeper) InboundQueueLength(ctx sdk.Context) (int32, error)

func (Keeper) IsHighPriorityAddress added in v0.34.0

func (k Keeper) IsHighPriorityAddress(ctx sdk.Context, addr sdk.AccAddress) (bool, error)

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) PathToEncodedKey added in v0.31.0

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

func (Keeper) PushAction

func (k Keeper) PushAction(ctx sdk.Context, action vm.Jsonable) error

PushAction appends an action to the controller's actionQueue.

func (Keeper) PushHighPriorityAction added in v0.34.0

func (k Keeper) PushHighPriorityAction(ctx sdk.Context, action vm.Jsonable) error

PushAction appends an action to the controller's highPriorityQueue.

func (Keeper) SetBeansOwing

func (k Keeper) SetBeansOwing(ctx sdk.Context, addr sdk.AccAddress, beans sdk.Uint)

SetBeansOwing sets the number of beans that the given address owes to the feeCollector but has not yet paid.

func (Keeper) SetEgress

func (k Keeper) SetEgress(ctx sdk.Context, egress *types.Egress) error

SetEgress sets the egress struct for a peer, and ensures its account exists

func (Keeper) SetMailbox

func (k Keeper) SetMailbox(ctx sdk.Context, peer string, mailbox string)

SetMailbox sets the entire mailbox struct for a peer

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

func (Keeper) SetState added in v0.32.0

func (k Keeper) SetState(ctx sdk.Context, state types.State)

func (Keeper) UpdateQueueAllowed added in v0.34.0

func (k Keeper) UpdateQueueAllowed(ctx sdk.Context) error

type Migrator added in v0.34.0

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

Migrator handles in-place store migrations.

func NewMigrator added in v0.34.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new migrator based on the keeper.

func (Migrator) Migrate1to2 added in v0.34.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

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

func (Querier) Mailbox

func (Querier) Params

type SwingStoreExporter added in v0.34.0

type SwingStoreExporter interface {
	ExportSwingStore(ctx sdk.Context) []*vstoragetypes.DataEntry
}

type SwingsetSnapshotter added in v0.34.0

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

func NewSwingsetSnapshotter added in v0.34.0

func NewSwingsetSnapshotter(app *baseapp.BaseApp, exporter SwingStoreExporter, sendToController func(bool, string) (string, error)) SwingsetSnapshotter

func (*SwingsetSnapshotter) InitiateSnapshot added in v0.34.0

func (snapshotter *SwingsetSnapshotter) InitiateSnapshot(height int64) error

InitiateSnapshot synchronously initiates a snapshot for the given height. If a snapshot is already in progress, or if no snapshot manager is configured, this will fail. The snapshot operation is performed in a goroutine, and synchronized with the main thread through the `WaitUntilSnapshotStarted` method.

func (*SwingsetSnapshotter) RestoreExtension added in v0.34.0

func (snapshotter *SwingsetSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshots.ExtensionPayloadReader) error

RestoreExtension restores an extension state snapshot, the payload reader returns `io.EOF` when it reaches the extension boundaries. Implements ExtensionSnapshotter

func (*SwingsetSnapshotter) SnapshotExtension added in v0.34.0

func (snapshotter *SwingsetSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshots.ExtensionPayloadWriter) (err error)

SnapshotExtension writes extension payloads into the underlying protobuf stream. This operation is invoked by the snapshot manager in the goroutine started by `InitiateSnapshot`. Implements ExtensionSnapshotter

func (*SwingsetSnapshotter) SnapshotFormat added in v0.34.0

func (snapshotter *SwingsetSnapshotter) SnapshotFormat() uint32

SnapshotFormat returns the default format the extension snapshotter uses to encode the payloads when taking a snapshot. It's defined within the extension, different from the global format for the whole state-sync snapshot. Implements ExtensionSnapshotter

func (*SwingsetSnapshotter) SnapshotName added in v0.34.0

func (snapshotter *SwingsetSnapshotter) SnapshotName() string

SnapshotName returns the name of snapshotter, it should be unique in the manager. Implements ExtensionSnapshotter

func (*SwingsetSnapshotter) SupportedFormats added in v0.34.0

func (snapshotter *SwingsetSnapshotter) SupportedFormats() []uint32

SupportedFormats returns a list of formats it can restore from. Implements ExtensionSnapshotter

func (*SwingsetSnapshotter) WaitUntilSnapshotStarted added in v0.34.0

func (snapshotter *SwingsetSnapshotter) WaitUntilSnapshotStarted() error

WaitUntilSnapshotStarted synchronizes with a snapshot in progress, if any. The JS SwingStore export must have started before a new block is committed. The app must call this method before sending a commit action to SwingSet.

Waits for a just initiated snapshot to have started in its goroutine. If no snapshot is in progress (`InitiateSnapshot` hasn't been called or already completed), or if we previously checked if the snapshot had started, returns immediately.

Jump to

Keyboard shortcuts

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