metrics

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.Register(2100, "not implemented")
	ErrFailedResponse = errors.Register(2002, "failed response")
)

Functions

func StreamSync

func StreamSync(ctx context.Context) error

StreamSync is expected to work similar to Sync but to use websocket and never quit unless context was cancelled.

func SubtractSets

func SubtractSets(a [][]byte, b [][]byte) [][]byte

SubtractSets returns all elements in a that are not in b

func Sync

func Sync(ctx context.Context, tmc *TendermintClient, st *store.Store, hrp string) (uint, error)

Sync uploads to local store all blocks that are not present yet, starting with the blocks with the lowest hight first. It always returns the number of blocks inserted, even if returning an error.

func ValidatorAddresses

func ValidatorAddresses(validators []*TendermintValidator) [][]byte

ValidatorAddresses extracts just the addresses of out a signing set

Types

type ABCIInfo

type ABCIInfo struct {
	LastBlockHeight int64 `json:"last_block_height"`
}

func AbciInfo

func AbciInfo(c *TendermintClient) (*ABCIInfo, error)

AbciInfo returns abci_info.

type TendermintBlock

type TendermintBlock struct {
	Height            int64
	Time              time.Time
	Transactions      []*bnsd.Tx
	TransactionHashes [][32]byte
}

func FetchBlock

func FetchBlock(ctx context.Context, c *TendermintClient, height int64) (*TendermintBlock, error)

type TendermintClient

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

func DialTendermint

func DialTendermint(websocketURL string) (*TendermintClient, error)

DialTendermint returns a client that is maintains a websocket connection to tendermint API. The websocket is used instead of standard HTTP connection to lower the latency, bypass throttling and to allow subscription requests.

func (*TendermintClient) Close

func (c *TendermintClient) Close() error

func (*TendermintClient) Do

func (c *TendermintClient) Do(method string, dest interface{}, args ...interface{}) error

Do makes a jsonrpc call. This method is safe for concurrent calls.

Use API as described in https://tendermint.com/rpc/

type TendermintCommit

type TendermintCommit struct {
	Height               int64
	Hash                 []byte
	Time                 time.Time
	ProposerAddress      []byte
	ValidatorsHash       []byte
	ParticipantAddresses [][]byte
}

func Commit

func Commit(ctx context.Context, c *TendermintClient, height int64) (*TendermintCommit, error)

type TendermintValidator

type TendermintValidator struct {
	Address []byte
	PubKey  []byte
}

func Validators

func Validators(ctx context.Context, c *TendermintClient, blockHeight int64) ([]*TendermintValidator, error)

Validators return all validators as represented on the block at given height.

Jump to

Keyboard shortcuts

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