state

package
v4.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuntimeVersionSubscription

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

RuntimeVersionSubscription is a subscription established through one of the Client's subscribe methods.

func (*RuntimeVersionSubscription) Chan

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*RuntimeVersionSubscription) Err

func (s *RuntimeVersionSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*RuntimeVersionSubscription) Unsubscribe

func (s *RuntimeVersionSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

type State

type State interface {
	GetStorage(key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
	GetStorageLatest(key types.StorageKey, target interface{}) (ok bool, err error)
	GetStorageRaw(key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
	GetStorageRawLatest(key types.StorageKey) (*types.StorageDataRaw, error)

	GetChildStorageSize(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.U64, error)
	GetChildStorageSizeLatest(childStorageKey, key types.StorageKey) (types.U64, error)
	GetChildStorage(childStorageKey, key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
	GetChildStorageLatest(childStorageKey, key types.StorageKey, target interface{}) (ok bool, err error)
	GetChildStorageRaw(childStorageKey, key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
	GetChildStorageRawLatest(childStorageKey, key types.StorageKey) (*types.StorageDataRaw, error)

	GetMetadata(blockHash types.Hash) (*types.Metadata, error)
	GetMetadataLatest() (*types.Metadata, error)

	GetStorageHash(key types.StorageKey, blockHash types.Hash) (types.Hash, error)
	GetStorageHashLatest(key types.StorageKey) (types.Hash, error)

	SubscribeStorageRaw(keys []types.StorageKey) (*StorageSubscription, error)

	GetRuntimeVersion(blockHash types.Hash) (*types.RuntimeVersion, error)
	GetRuntimeVersionLatest() (*types.RuntimeVersion, error)

	GetChildKeys(childStorageKey, prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
	GetChildKeysLatest(childStorageKey, prefix types.StorageKey) ([]types.StorageKey, error)

	SubscribeRuntimeVersion() (*RuntimeVersionSubscription, error)

	QueryStorage(keys []types.StorageKey, startBlock types.Hash, block types.Hash) ([]types.StorageChangeSet, error)
	QueryStorageLatest(keys []types.StorageKey, startBlock types.Hash) ([]types.StorageChangeSet, error)

	QueryStorageAt(keys []types.StorageKey, block types.Hash) ([]types.StorageChangeSet, error)
	QueryStorageAtLatest(keys []types.StorageKey) ([]types.StorageChangeSet, error)

	GetKeys(prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
	GetKeysLatest(prefix types.StorageKey) ([]types.StorageKey, error)

	GetStorageSize(key types.StorageKey, blockHash types.Hash) (types.U64, error)
	GetStorageSizeLatest(key types.StorageKey) (types.U64, error)

	GetChildStorageHash(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.Hash, error)
	GetChildStorageHashLatest(childStorageKey, key types.StorageKey) (types.Hash, error)
}

func NewState

func NewState(c client.Client) State

NewState creates a new state struct

type StorageSubscription

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

StorageSubscription is a subscription established through one of the Client's subscribe methods.

func (*StorageSubscription) Chan

func (s *StorageSubscription) Chan() <-chan types.StorageChangeSet

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*StorageSubscription) Err

func (s *StorageSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*StorageSubscription) Unsubscribe

func (s *StorageSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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