Documentation ¶
Overview ¶
Package localstatequery implements the Ouroboros local-state-query protocol
Index ¶
- Constants
- Variables
- func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)
- type AcquireFailurePointNotOnChainError
- type AcquireFailurePointTooOldError
- type AcquireFunc
- type Client
- func (c *Client) Acquire(point *common.Point) error
- func (c *Client) DebugChainDepState() (*DebugChainDepStateResult, error)
- func (c *Client) DebugEpochState() (*DebugEpochStateResult, error)
- func (c *Client) DebugNewEpochState() (*DebugNewEpochStateResult, error)
- func (c *Client) GetChainBlockNo() (int64, error)
- func (c *Client) GetChainPoint() (*common.Point, error)
- func (c *Client) GetCurrentEra() (int, error)
- func (c *Client) GetCurrentProtocolParams() (*CurrentProtocolParamsResult, error)
- func (c *Client) GetEpochNo() (int, error)
- func (c *Client) GetEraHistory() ([]EraHistoryResult, error)
- func (c *Client) GetFilteredDelegationsAndRewardAccounts(creds []interface{}) (*FilteredDelegationsAndRewardAccountsResult, error)
- func (c *Client) GetGenesisConfig() (*GenesisConfigResult, error)
- func (c *Client) GetNonMyopicMemberRewards() (*NonMyopicMemberRewardsResult, error)
- func (c *Client) GetPoolDistr(poolIds []interface{}) (*PoolDistrResult, error)
- func (c *Client) GetPoolState(poolIds []interface{}) (*PoolStateResult, error)
- func (c *Client) GetProposedProtocolParamsUpdates() (*ProposedProtocolParamsUpdatesResult, error)
- func (c *Client) GetRewardInfoPools() (*RewardInfoPoolsResult, error)
- func (c *Client) GetRewardProvenance() (*RewardProvenanceResult, error)
- func (c *Client) GetStakeDistribution() (*StakeDistributionResult, error)
- func (c *Client) GetStakePoolParams(poolIds []interface{}) (*StakePoolParamsResult, error)
- func (c *Client) GetStakePools() (*StakePoolsResult, error)
- func (c *Client) GetStakeSnapshots(poolId interface{}) (*StakeSnapshotsResult, error)
- func (c *Client) GetSystemStart() (*SystemStartResult, error)
- func (c *Client) GetUTxOByAddress(addrs []interface{}) (*UTxOByAddressResult, error)
- func (c *Client) GetUTxOByTxIn(txins []interface{}) (*UTxOByTxInResult, error)
- func (c *Client) GetUTxOWhole() (*UTxOWholeResult, error)
- func (c *Client) Release() error
- type Config
- type CurrentProtocolParamsResult
- type DebugChainDepStateResult
- type DebugEpochStateResult
- type DebugNewEpochStateResult
- type DoneFunc
- type EraHistoryResult
- type FilteredDelegationsAndRewardAccountsResult
- type GenesisConfigResult
- type LocalStateQuery
- type LocalStateQueryOptionFunc
- func WithAcquireFunc(acquireFunc AcquireFunc) LocalStateQueryOptionFunc
- func WithAcquireTimeout(timeout time.Duration) LocalStateQueryOptionFunc
- func WithDoneFunc(doneFunc DoneFunc) LocalStateQueryOptionFunc
- func WithQueryFunc(queryFunc QueryFunc) LocalStateQueryOptionFunc
- func WithQueryTimeout(timeout time.Duration) LocalStateQueryOptionFunc
- func WithReAcquireFunc(reAcquireFunc ReAcquireFunc) LocalStateQueryOptionFunc
- func WithReleaseFunc(releaseFunc ReleaseFunc) LocalStateQueryOptionFunc
- type MsgAcquire
- type MsgAcquireNoPoint
- type MsgAcquired
- type MsgDone
- type MsgFailure
- type MsgQuery
- type MsgReAcquire
- type MsgReAcquireNoPoint
- type MsgRelease
- type MsgResult
- type NonMyopicMemberRewardsResult
- type PoolDistrResult
- type PoolStateResult
- type ProposedProtocolParamsUpdatesResult
- type QueryFunc
- type ReAcquireFunc
- type ReleaseFunc
- type RewardInfoPoolsResult
- type RewardProvenanceResult
- type Server
- type StakeDistributionResult
- type StakePoolParamsResult
- type StakePoolsResult
- type StakeSnapshotsResult
- type SystemStartResult
- type UTxOByAddressResult
- type UTxOByTxInResult
- type UTxOWholeResult
Constants ¶
const ( MessageTypeAcquire = 0 MessageTypeAcquired = 1 MessageTypeFailure = 2 MessageTypeQuery = 3 MessageTypeResult = 4 MessageTypeRelease = 5 MessageTypeReacquire = 6 MessageTypeDone = 7 MessageTypeAcquireNoPoint = 8 MessageTypeReacquireNoPoint = 9 )
Message types
const ( AcquireFailurePointTooOld = 0 AcquireFailurePointNotOnChain = 1 )
Acquire failure reasons
const ( QueryTypeBlock = 0 QueryTypeSystemStart = 1 QueryTypeChainBlockNo = 2 QueryTypeChainPoint = 3 // Block query sub-types QueryTypeShelley = 0 QueryTypeHardFork = 2 // Hard fork query sub-types QueryTypeHardForkEraHistory = 0 QueryTypeHardForkCurrentEra = 1 // Shelley query sub-types QueryTypeShelleyLedgerTip = 0 QueryTypeShelleyEpochNo = 1 QueryTypeShelleyNonMyopicMemberRewards = 2 QueryTypeShelleyCurrentProtocolParams = 3 QueryTypeShelleyProposedProtocolParamsUpdates = 4 QueryTypeShelleyStakeDistribution = 5 QueryTypeShelleyUtxoByAddress = 6 QueryTypeShelleyUtxoWhole = 7 QueryTypeShelleyDebugEpochState = 8 QueryTypeShelleyCbor = 9 QueryTypeShelleyFilteredDelegationAndRewardAccounts = 10 QueryTypeShelleyGenesisConfig = 11 QueryTypeShelleyDebugNewEpochState = 12 QueryTypeShelleyDebugChainDepState = 13 QueryTypeShelleyRewardProvenance = 14 QueryTypeShelleyUtxoByTxin = 15 QueryTypeShelleyStakePools = 16 QueryTypeShelleyStakePoolParams = 17 QueryTypeShelleyRewardInfoPools = 18 QueryTypeShelleyPoolState = 19 QueryTypeShelleyStakeSnapshots = 20 QueryTypeShelleyPoolDistr = 21 )
Query types
Variables ¶
var StateMap = protocol.StateMap{ // contains filtered or unexported fields }
LocalStateQuery protocol state machine
Functions ¶
Types ¶
type AcquireFailurePointNotOnChainError ¶
type AcquireFailurePointNotOnChainError struct { }
AcquireFailurePointNotOnChainError indicates a failure to acquire a point due to it not being present on the chain
func (AcquireFailurePointNotOnChainError) Error ¶
func (e AcquireFailurePointNotOnChainError) Error() string
type AcquireFailurePointTooOldError ¶
type AcquireFailurePointTooOldError struct { }
AcquireFailurePointTooOldError indicates a failure to acquire a point due to it being too old
func (AcquireFailurePointTooOldError) Error ¶
func (e AcquireFailurePointTooOldError) Error() string
type AcquireFunc ¶
type AcquireFunc func(interface{}) error
Callback function types TODO: update callbacks
type Client ¶
Client implements the LocalStateQuery client
func NewClient ¶
func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client
NewClient returns a new LocalStateQuery client object
func (*Client) DebugChainDepState ¶
func (c *Client) DebugChainDepState() (*DebugChainDepStateResult, error)
TODO
func (*Client) DebugEpochState ¶
func (c *Client) DebugEpochState() (*DebugEpochStateResult, error)
TODO
func (*Client) DebugNewEpochState ¶
func (c *Client) DebugNewEpochState() (*DebugNewEpochStateResult, error)
TODO
func (*Client) GetChainBlockNo ¶
GetChainBlockNo returns the latest block number
func (*Client) GetChainPoint ¶
GetChainPoint returns the current chain tip
func (*Client) GetCurrentEra ¶
GetCurrentEra returns the current era ID
func (*Client) GetCurrentProtocolParams ¶
func (c *Client) GetCurrentProtocolParams() (*CurrentProtocolParamsResult, error)
GetCurrentProtocolParams returns the set of protocol params that are currently in effect
func (*Client) GetEpochNo ¶
GetEpochNo returns the current epoch number
func (*Client) GetEraHistory ¶
func (c *Client) GetEraHistory() ([]EraHistoryResult, error)
GetEraHistory returns the era history
func (*Client) GetFilteredDelegationsAndRewardAccounts ¶
func (c *Client) GetFilteredDelegationsAndRewardAccounts(creds []interface{}) (*FilteredDelegationsAndRewardAccountsResult, error)
TODO
func (*Client) GetGenesisConfig ¶
func (c *Client) GetGenesisConfig() (*GenesisConfigResult, error)
TODO
func (*Client) GetNonMyopicMemberRewards ¶
func (c *Client) GetNonMyopicMemberRewards() (*NonMyopicMemberRewardsResult, error)
TODO
func (*Client) GetPoolDistr ¶
func (c *Client) GetPoolDistr(poolIds []interface{}) (*PoolDistrResult, error)
TODO
func (*Client) GetPoolState ¶
func (c *Client) GetPoolState(poolIds []interface{}) (*PoolStateResult, error)
TODO
func (*Client) GetProposedProtocolParamsUpdates ¶
func (c *Client) GetProposedProtocolParamsUpdates() (*ProposedProtocolParamsUpdatesResult, error)
TODO
func (*Client) GetRewardInfoPools ¶
func (c *Client) GetRewardInfoPools() (*RewardInfoPoolsResult, error)
TODO
func (*Client) GetRewardProvenance ¶
func (c *Client) GetRewardProvenance() (*RewardProvenanceResult, error)
TODO
func (*Client) GetStakeDistribution ¶
func (c *Client) GetStakeDistribution() (*StakeDistributionResult, error)
GetStakeDistribution returns the stake distribution
func (*Client) GetStakePoolParams ¶
func (c *Client) GetStakePoolParams(poolIds []interface{}) (*StakePoolParamsResult, error)
TODO
func (*Client) GetStakeSnapshots ¶
func (c *Client) GetStakeSnapshots(poolId interface{}) (*StakeSnapshotsResult, error)
TODO
func (*Client) GetSystemStart ¶
func (c *Client) GetSystemStart() (*SystemStartResult, error)
GetSystemStart returns the SystemStart value
func (*Client) GetUTxOByAddress ¶
func (c *Client) GetUTxOByAddress(addrs []interface{}) (*UTxOByAddressResult, error)
TODO
func (*Client) GetUTxOByTxIn ¶
func (c *Client) GetUTxOByTxIn(txins []interface{}) (*UTxOByTxInResult, error)
TODO
type Config ¶
type Config struct { AcquireFunc AcquireFunc QueryFunc QueryFunc ReleaseFunc ReleaseFunc ReAcquireFunc ReAcquireFunc DoneFunc DoneFunc AcquireTimeout time.Duration QueryTimeout time.Duration }
Config is used to configure the LocalStateQuery protocol instance
func NewConfig ¶
func NewConfig(options ...LocalStateQueryOptionFunc) Config
NewConfig returns a new LocalStateQuery config object with the provided options
type CurrentProtocolParamsResult ¶
type CurrentProtocolParamsResult struct { MinFeeA int MinFeeB int MaxBlockBodySize int MaxTxSize int MaxBlockHeaderSize int KeyDeposit int PoolDeposit int EMax int NOpt int A0 []int Rho []int Tau []int // This field no longer exists in Babbage, but we're keeping this here for reference // unless we need to support querying a node still on an older era //DecentralizationParam []int ProtocolVersionMajor int ProtocolVersionMinor int MinPoolCost int Unknown interface{} CostModels interface{} ExecutionUnitPrices interface{} // [priceMemory priceSteps] both elements are fractions MaxTxExecutionUnits []uint MaxBlockExecutionUnits []uint MaxValueSize int CollateralPercentage int // contains filtered or unexported fields }
type DebugChainDepStateResult ¶
type DebugChainDepStateResult interface{}
type DebugEpochStateResult ¶
type DebugEpochStateResult interface{}
type EraHistoryResult ¶
type EraHistoryResult struct { Begin eraHistoryResultBeginEnd End eraHistoryResultBeginEnd Params eraHistoryResultParams // contains filtered or unexported fields }
type FilteredDelegationsAndRewardAccountsResult ¶
type FilteredDelegationsAndRewardAccountsResult interface{}
type GenesisConfigResult ¶
type GenesisConfigResult struct { Start SystemStartResult NetworkMagic int NetworkId uint8 ActiveSlotsCoeff []interface{} SecurityParam int EpochLength int SlotsPerKESPeriod int MaxKESEvolutions int SlotLength int UpdateQuorum int MaxLovelaceSupply int64 ProtocolParams struct { MinFeeA int MinFeeB int MaxBlockBodySize int MaxTxSize int MaxBlockHeaderSize int KeyDeposit int PoolDeposit int EMax int NOpt int A0 []int Rho []int Tau []int DecentralizationParam []int ExtraEntropy interface{} ProtocolVersionMajor int ProtocolVersionMinor int MinUTxOValue int MinPoolCost int // contains filtered or unexported fields } // This value contains maps with bytestring keys, which we can't parse yet GenDelegs cbor.RawMessage Unknown1 interface{} Unknown2 interface{} // contains filtered or unexported fields }
type LocalStateQuery ¶
LocalStateQuery is a wrapper object that holds the client and server instances
func New ¶
func New(protoOptions protocol.ProtocolOptions, cfg *Config) *LocalStateQuery
New returns a new LocalStateQuery object
type LocalStateQueryOptionFunc ¶
type LocalStateQueryOptionFunc func(*Config)
LocalStateQueryOptionFunc represents a function used to modify the LocalStateQuery protocol config
func WithAcquireFunc ¶
func WithAcquireFunc(acquireFunc AcquireFunc) LocalStateQueryOptionFunc
WithAcquireFunc specifies the Acquire callback function when acting as a server
func WithAcquireTimeout ¶
func WithAcquireTimeout(timeout time.Duration) LocalStateQueryOptionFunc
WithAcquireTimeout specifies the timeout for the Acquire operation when acting as a client
func WithDoneFunc ¶
func WithDoneFunc(doneFunc DoneFunc) LocalStateQueryOptionFunc
WithDoneFunc specifies the Done callback function when acting as a server
func WithQueryFunc ¶
func WithQueryFunc(queryFunc QueryFunc) LocalStateQueryOptionFunc
WithQueryFunc specifies the Query callback function when acting as a server
func WithQueryTimeout ¶
func WithQueryTimeout(timeout time.Duration) LocalStateQueryOptionFunc
WithQueryTimeout specifies the timeout for the Query operation when acting as a client
func WithReAcquireFunc ¶
func WithReAcquireFunc(reAcquireFunc ReAcquireFunc) LocalStateQueryOptionFunc
WithReAcquireFunc specifies the ReAcquire callback function when acting as a server
func WithReleaseFunc ¶
func WithReleaseFunc(releaseFunc ReleaseFunc) LocalStateQueryOptionFunc
WithReleaseFunc specifies the Release callback function when acting as a server
type MsgAcquire ¶
type MsgAcquire struct { protocol.MessageBase Point common.Point }
func NewMsgAcquire ¶
func NewMsgAcquire(point common.Point) *MsgAcquire
type MsgAcquireNoPoint ¶
type MsgAcquireNoPoint struct {
protocol.MessageBase
}
func NewMsgAcquireNoPoint ¶
func NewMsgAcquireNoPoint() *MsgAcquireNoPoint
type MsgAcquired ¶
type MsgAcquired struct {
protocol.MessageBase
}
func NewMsgAcquired ¶
func NewMsgAcquired() *MsgAcquired
type MsgDone ¶
type MsgDone struct {
protocol.MessageBase
}
func NewMsgDone ¶
func NewMsgDone() *MsgDone
type MsgFailure ¶
type MsgFailure struct { protocol.MessageBase Failure uint8 }
func NewMsgFailure ¶
func NewMsgFailure(failure uint8) *MsgFailure
type MsgQuery ¶
type MsgQuery struct { protocol.MessageBase Query interface{} }
func NewMsgQuery ¶
func NewMsgQuery(query interface{}) *MsgQuery
type MsgReAcquire ¶
type MsgReAcquire struct { protocol.MessageBase Point common.Point }
func NewMsgReAcquire ¶
func NewMsgReAcquire(point common.Point) *MsgReAcquire
type MsgReAcquireNoPoint ¶
type MsgReAcquireNoPoint struct {
protocol.MessageBase
}
func NewMsgReAcquireNoPoint ¶
func NewMsgReAcquireNoPoint() *MsgReAcquireNoPoint
type MsgRelease ¶
type MsgRelease struct {
protocol.MessageBase
}
func NewMsgRelease ¶
func NewMsgRelease() *MsgRelease
type MsgResult ¶
type MsgResult struct { protocol.MessageBase Result cbor.RawMessage }
func NewMsgResult ¶
type PoolDistrResult ¶
type PoolDistrResult interface{}
type PoolStateResult ¶
type PoolStateResult interface{}
type ProposedProtocolParamsUpdatesResult ¶
type ProposedProtocolParamsUpdatesResult interface{}
TODO
type ReAcquireFunc ¶
type ReAcquireFunc func(interface{}) error
type ReleaseFunc ¶
type ReleaseFunc func() error
type RewardInfoPoolsResult ¶
type RewardInfoPoolsResult interface{}
type RewardProvenanceResult ¶
type RewardProvenanceResult interface{}
type StakeDistributionResult ¶
type StakeDistributionResult interface{}
type StakePoolParamsResult ¶
type StakePoolParamsResult interface{}
type StakePoolsResult ¶
type StakePoolsResult interface{}
type StakeSnapshotsResult ¶
type StakeSnapshotsResult interface{}
type SystemStartResult ¶
type UTxOByAddressResult ¶
type UTxOByAddressResult interface{}
type UTxOByTxInResult ¶
type UTxOByTxInResult interface{}
type UTxOWholeResult ¶
type UTxOWholeResult interface{}