Documentation ¶
Index ¶
- func InitMetrics()
- type BlockErrorPair
- type BlocksMap
- type Client
- func (c *Client) GetBlock(ctx context.Context, params structs.HeightHash) (block structs.Block, er error)
- func (c Client) GetBlockAsync(ctx context.Context, in chan uint64, out chan<- BlockErrorPair)
- func (c Client) GetBlocksMeta(ctx context.Context, params structs.HeightRange, blocks *BlocksMap) error
- func (c *Client) GetRewardBalances(ctx context.Context, pparams []structs.HeightAccount) (resps map[uint64]structs.GetRewardResponse, err error)
- func (c *Client) GetTx(ctx context.Context, qstring []string) (txs []*tx.GetTxsEventResponse, err error)
- func (c *Client) SearchTx(ctx context.Context, r structs.HeightHash, block structs.Block, perPage uint64) (txs []structs.Transaction, err error)
- type ClientConfig
- type SimpleBlockCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockErrorPair ¶
BlockErrorPair to wrap error response
type BlocksMap ¶
BlocksMap map of blocks to control block map with extra summary of number of transactions
type Client ¶
type Client struct { Sbc *SimpleBlockCache // contains filtered or unexported fields }
Client
func NewClient ¶
func NewClient(logger *zap.Logger, cli *grpc.ClientConn, cfg *ClientConfig) *Client
NewClient returns a new client for a given endpoint
func (*Client) GetBlock ¶
func (c *Client) GetBlock(ctx context.Context, params structs.HeightHash) (block structs.Block, er error)
GetBlock fetches most recent block from chain
func (Client) GetBlockAsync ¶
func (c Client) GetBlockAsync(ctx context.Context, in chan uint64, out chan<- BlockErrorPair)
func (Client) GetBlocksMeta ¶
func (*Client) GetRewardBalances ¶ added in v0.3.1
func (c *Client) GetRewardBalances(ctx context.Context, pparams []structs.HeightAccount) (resps map[uint64]structs.GetRewardResponse, err error)
GetReward fetches total rewards for delegator account
type ClientConfig ¶ added in v0.1.5
type SimpleBlockCache ¶
type SimpleBlockCache struct {
// contains filtered or unexported fields
}
SimpleBlockCache simple in memory block cache to store latest blocks
func NewSimpleBlockCache ¶
func NewSimpleBlockCache(cap int) *SimpleBlockCache
NewSimpleBlockCache a SimpleBlockCache constructor
func (*SimpleBlockCache) Add ¶
func (sbc *SimpleBlockCache) Add(bl structs.Block)
Add blocks to the cache (thread safe)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.