Documentation ¶
Index ¶
- type RuntimeVersionSubscription
- type State
- func (s *State) GetChildKeys(childStorageKey, prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
- func (s *State) GetChildKeysLatest(childStorageKey, prefix types.StorageKey) ([]types.StorageKey, error)
- func (s *State) GetChildStorage(childStorageKey, key types.StorageKey, target interface{}, ...) (ok bool, err error)
- func (s *State) GetChildStorageHash(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.Hash, error)
- func (s *State) GetChildStorageHashLatest(childStorageKey, key types.StorageKey) (types.Hash, error)
- func (s *State) GetChildStorageLatest(childStorageKey, key types.StorageKey, target interface{}) (ok bool, err error)
- func (s *State) GetChildStorageRaw(childStorageKey, key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
- func (s *State) GetChildStorageRawLatest(childStorageKey, key types.StorageKey) (*types.StorageDataRaw, error)
- func (s *State) GetChildStorageSize(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.U64, error)
- func (s *State) GetChildStorageSizeLatest(childStorageKey, key types.StorageKey) (types.U64, error)
- func (s *State) GetConst(prefix, name string, res interface{}) error
- func (s *State) GetConstWithMetadata(meta *types.Metadata, prefix, name string, res interface{}) error
- func (s *State) GetKeys(prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
- func (s *State) GetKeysLatest(prefix types.StorageKey) ([]types.StorageKey, error)
- func (s *State) GetMetadata(blockHash types.Hash) (*types.Metadata, error)
- func (s *State) GetMetadataLatest() (*types.Metadata, error)
- func (s *State) GetRuntimeVersion(blockHash types.Hash) (*types.RuntimeVersion, error)
- func (s *State) GetRuntimeVersionLatest() (*types.RuntimeVersion, error)
- func (s *State) GetStorage(key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
- func (s *State) GetStorageHash(key types.StorageKey, blockHash types.Hash) (types.Hash, error)
- func (s *State) GetStorageHashLatest(key types.StorageKey) (types.Hash, error)
- func (s *State) GetStorageLatest(key types.StorageKey, target interface{}) (ok bool, err error)
- func (s *State) GetStorageRaw(key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
- func (s *State) GetStorageRawLatest(key types.StorageKey) (*types.StorageDataRaw, error)
- func (s *State) GetStorageSize(key types.StorageKey, blockHash types.Hash) (types.U64, error)
- func (s *State) GetStorageSizeLatest(key types.StorageKey) (types.U64, error)
- func (s *State) QueryStorage(keys []types.StorageKey, startBlock types.Hash, block types.Hash) ([]types.StorageChangeSet, error)
- func (s *State) QueryStorageLatest(keys []types.StorageKey, startBlock types.Hash) ([]types.StorageChangeSet, error)
- func (s *State) SubscribeRuntimeVersion() (*RuntimeVersionSubscription, error)
- func (s *State) SubscribeStorageRaw(keys []types.StorageKey) (*StorageSubscription, error)
- type StorageSubscription
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 ¶
func (s *RuntimeVersionSubscription) Chan() <-chan types.RuntimeVersion
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 struct {
// contains filtered or unexported fields
}
State exposes methods for querying state
func (*State) GetChildKeys ¶
func (s *State) GetChildKeys(childStorageKey, prefix types.StorageKey, blockHash types.Hash) ( []types.StorageKey, error)
GetChildKeys retreives the keys with the given prefix of a specific child storage
func (*State) GetChildKeysLatest ¶
func (s *State) GetChildKeysLatest(childStorageKey, prefix types.StorageKey) ([]types.StorageKey, error)
GetChildKeysLatest retreives the keys with the given prefix of a specific child storage for the latest block height
func (*State) GetChildStorage ¶
func (s *State) GetChildStorage(childStorageKey, key types.StorageKey, target interface{}, blockHash types.Hash) ( ok bool, err error)
GetChildStorage retreives the child storage for a key and decodes them into the provided interface. Ok is true if the value is not empty.
func (*State) GetChildStorageHash ¶
func (s *State) GetChildStorageHash(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.Hash, error)
GetChildStorageHash retreives the child storage hash for the given key
func (*State) GetChildStorageHashLatest ¶
func (s *State) GetChildStorageHashLatest(childStorageKey, key types.StorageKey) (types.Hash, error)
GetChildStorageHashLatest retreives the child storage hash for the given key for the latest block height
func (*State) GetChildStorageLatest ¶
func (s *State) GetChildStorageLatest(childStorageKey, key types.StorageKey, target interface{}) (ok bool, err error)
GetChildStorageLatest retreives the child storage for a key for the latest block height and decodes them into the provided interface. Ok is true if the value is not empty.
func (*State) GetChildStorageRaw ¶
func (s *State) GetChildStorageRaw(childStorageKey, key types.StorageKey, blockHash types.Hash) ( *types.StorageDataRaw, error)
GetChildStorageRaw retreives the child storage for a key as raw bytes, without decoding them
func (*State) GetChildStorageRawLatest ¶
func (s *State) GetChildStorageRawLatest(childStorageKey, key types.StorageKey) (*types.StorageDataRaw, error)
GetChildStorageRawLatest retreives the child storage for a key for the latest block height as raw bytes, without decoding them
func (*State) GetChildStorageSize ¶
func (s *State) GetChildStorageSize(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.U64, error)
GetChildStorageSize retreives the child storage size for the given key
func (*State) GetChildStorageSizeLatest ¶
GetChildStorageSizeLatest retreives the child storage size for the given key for the latest block height
func (*State) GetConstWithMetadata ¶
func (*State) GetKeys ¶
func (s *State) GetKeys(prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
GetKeys retreives the keys with the given prefix
func (*State) GetKeysLatest ¶
func (s *State) GetKeysLatest(prefix types.StorageKey) ([]types.StorageKey, error)
GetKeysLatest retreives the keys with the given prefix for the latest block height
func (*State) GetMetadata ¶
GetMetadata returns the metadata at the given block
func (*State) GetMetadataLatest ¶
GetMetadataLatest returns the latest metadata
func (*State) GetRuntimeVersion ¶
GetRuntimeVersion returns the runtime version at the given block
func (*State) GetRuntimeVersionLatest ¶
func (s *State) GetRuntimeVersionLatest() (*types.RuntimeVersion, error)
GetRuntimeVersionLatest returns the latest runtime version
func (*State) GetStorage ¶
func (s *State) GetStorage(key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
GetStorage retreives the stored data and decodes them into the provided interface. Ok is true if the value is not empty.
func (*State) GetStorageHash ¶
GetStorageHash retreives the storage hash for the given key
func (*State) GetStorageHashLatest ¶
GetStorageHashLatest retreives the storage hash for the given key for the latest block height
func (*State) GetStorageLatest ¶
func (s *State) GetStorageLatest(key types.StorageKey, target interface{}) (ok bool, err error)
GetStorageLatest retreives the stored data for the latest block height and decodes them into the provided interface. Ok is true if the value is not empty.
func (*State) GetStorageRaw ¶
func (s *State) GetStorageRaw(key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
GetStorageRaw retreives the stored data as raw bytes, without decoding them
func (*State) GetStorageRawLatest ¶
func (s *State) GetStorageRawLatest(key types.StorageKey) (*types.StorageDataRaw, error)
GetStorageRawLatest retreives the stored data for the latest block height as raw bytes, without decoding them
func (*State) GetStorageSize ¶
GetStorageSize retreives the storage size for the given key
func (*State) GetStorageSizeLatest ¶
GetStorageSizeLatest retreives the storage size for the given key for the latest block height
func (*State) QueryStorage ¶
func (s *State) QueryStorage(keys []types.StorageKey, startBlock types.Hash, block types.Hash) ( []types.StorageChangeSet, error)
QueryStorage queries historical storage entries (by key) starting from a start block until an end block
func (*State) QueryStorageLatest ¶
func (s *State) QueryStorageLatest(keys []types.StorageKey, startBlock types.Hash) ([]types.StorageChangeSet, error)
QueryStorageLatest queries historical storage entries (by key) starting from a start block until the latest block
func (*State) SubscribeRuntimeVersion ¶
func (s *State) SubscribeRuntimeVersion() ( *RuntimeVersionSubscription, error)
SubscribeRuntimeVersion subscribes the runtime version, returning a subscription that will receive server notifications containing the RuntimeVersion.
func (*State) SubscribeStorageRaw ¶
func (s *State) SubscribeStorageRaw(keys []types.StorageKey) ( *StorageSubscription, error)
SubscribeStorageRaw subscribes the storage for the given keys, returning a subscription that will receive server notifications containing the storage change sets.
Slow subscribers will be dropped eventually. Client buffers up to 20000 notifications before considering the subscriber dead. The subscription Err channel will receive ErrSubscriptionQueueOverflow. Use a sufficiently large buffer on the channel or ensure that the channel usually has at least one reader to prevent this issue.
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.