chain

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	GetHeight() uint64
	GetTxs() []Transaction
	GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error)
}

type BlockConsumerConfig added in v0.31.1

type BlockConsumerConfig struct {
	// The maximum number of requests to make per TimeBase before throttling requests
	MaxRequests int
	// The base duration over which to count requests to check for overage of MaxRequests
	TimeBase time.Duration
	// The base backoff - we wait this amount of time between each batch and we increase the backoff exponentially
	// until we reach MaxRetries from BaseBackoffDuration
	BaseBackoffDuration time.Duration
	// The maximum number of retries before failing
	MaxRetries uint64
	// The default and maximum batch size for block requests, we will reduce it logarithmically to a single block
	// when backing off
	MaxBlockBatchSize uint64
}

Client-side block consumer configuration. Requests are retried subject to backoff if a non-fatal error is detected

func (*BlockConsumerConfig) Complete added in v0.31.1

func (config *BlockConsumerConfig) Complete()

type Chain

type Chain interface {
	GetChainID() string
	GetVersion() string
	ConsumeBlocks(ctx context.Context, in *rpcevents.BlockRange, consumer func(Block) error) error
	StatusMessage(ctx context.Context, lastProcessedHeight uint64) []interface{}
	Connectivity() connectivity.State
	GetABI(ctx context.Context, address crypto.Address) (string, error)
	Close() error
}

type Event

type Event interface {
	query.Tagged
	GetIndex() uint64
	GetTransactionHash() binary.HexBytes
	GetAddress() crypto.Address
	GetTopics() []binary.Word256
	GetData() []byte
}

type Filter

type Filter struct {
	Addresses []crypto.Address
	Topics    []binary.Word256
}

type Origin

type Origin struct {
	// The original ChainID from for this transaction
	ChainID string
	// The original height at which this transaction was committed
	Height uint64
	// The original index in the block
	Index uint64
}

type Transaction

type Transaction interface {
	GetHash() binary.HexBytes
	GetIndex() uint64
	GetEvents() []Event
	GetException() *errors.Exception
	GetOrigin() *Origin
	GetMetadata(columns types.SQLColumnNames) (map[string]interface{}, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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