options

package
v0.0.0-...-5068cfe Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnMapping

type ColumnMapping struct{}

ColumnMapping represents the column mapping for stream function output. TODO

type HexOutput

type HexOutput int

HexOutput represents the formatting of binary columns numbers into UTF8 hex.

const (
	HexOutputDefault HexOutput = iota
)

type Node

type Node struct {
	// Type represents the type of the node.
	Type utils.Network `mapstructure:"type" yaml:"type" json:"type"`

	// NetworkId represents the network ID of the node.
	NetworkId utils.NetworkID `mapstructure:"networkId" yaml:"networkId" json:"networkId"`

	// Endpoint represents the network endpoint of the node.
	Endpoint string `mapstructure:"endpoint" yaml:"endpoint" json:"endpoint"`

	// RpcEndpoint ...
	RpcEndpoint string `mapstructure:"rpcEndpoint" yaml:"rpcEndpoint" json:"rpcEndpoint"`

	// BearerToken is the HyperSync server bearer token.
	BearerToken *string `mapstructure:"bearerToken" yaml:"bearerToken" json:"bearerToken"`

	// HTTPReqTimeoutMillis is the number of milliseconds to wait for a response before timing out.
	HTTPReqTimeoutMs *time.Duration `mapstructure:"httpReqTimeoutMs" yaml:"httpReqTimeoutMs" json:"httpReqTimeoutMs"`

	// MaxNumRetries is the number of retries to attempt before returning an error.
	MaxNumRetries int `mapstructure:"maxNumRetries" yaml:"maxNumRetries" json:"maxNumRetries" default:"12"`

	// RetryBackoffMs is the number of milliseconds used for retry backoff increasing.
	RetryBackoffMs time.Duration `mapstructure:"retryBackoffMs" yaml:"retryBackoffMs" json:"retryBackoffMs" default:"1ms"`

	// RetryBaseMs is the initial wait time for request backoff.
	RetryBaseMs time.Duration `mapstructure:"retryBaseMs" yaml:"retryBaseMs" json:"retryBaseMs"`

	// RetryCeilingMs is the ceiling time for request backoff.
	RetryCeilingMs time.Duration `mapstructure:"retryCeilingMs" yaml:"retryCeilingMs" json:"retryCeilingMs"`
}

Node represents the configuration and details of a network node.

func (*Node) GetEndpoint

func (n *Node) GetEndpoint() string

GetEndpoint returns the network endpoint of the node.

func (*Node) GetNetworkID

func (n *Node) GetNetworkID() int64

GetNetworkID returns the network ID of the node.

func (*Node) GetType

func (n *Node) GetType() utils.Network

GetType returns the type of the node.

type Options

type Options struct {
	// LogLevel ...
	LogLevel zapcore.Level `json:"logLevel"`
	// Nodes is a slice of Node representing the network nodes.
	Blockchains []Node `mapstructure:"blockchains" yaml:"blockchains" json:"blockchains"`
}

Options represents the configuration options for network nodes.

func (*Options) GetBlockchains

func (o *Options) GetBlockchains() []Node

GetBlockchains returns the slice of network blockchains nodes from the Options.

func (*Options) GetNodeByNetworkId

func (o *Options) GetNodeByNetworkId(networkId utils.NetworkID) (*Node, bool)

func (*Options) Validate

func (o *Options) Validate() error

type StreamOptions

type StreamOptions struct {
	// ColumnMapping is the column mapping for stream function output.
	// It lets you map columns you want into the DataTypes you want.
	ColumnMapping *ColumnMapping `mapstructure:"columnMapping" yaml:"columnMapping" json:"columnMapping"`

	// HexOutput determines the formatting of binary columns numbers into UTF8 hex.
	HexOutput HexOutput `mapstructure:"hexOutput" yaml:"hexOutput" json:"hexOutput"`

	// Concurrency is the number of async threads that would be spawned to execute different block ranges of queries.
	Concurrency *big.Int `mapstructure:"concurrency" yaml:"concurrency" json:"concurrency"`

	// BatchSize is the initial batch size. Size would be adjusted based on response size during execution.
	BatchSize *big.Int `mapstructure:"batchSize" yaml:"batchSize" json:"batchSize"`

	// DisableAcknowledgements streaming as soon as all retrievals are completed will signal completion of workload.
	// WARNING: Disable on your own will, you should not touch this if you're not sure why.
	// If unsure, leave as is and don't touch this option!
	DisableAcknowledgements bool `yaml:"disableAcknowledgements" json:"disableAcknowledgements" mapstructure:"disableAcknowledgements"`

	// MaxBatchSize is the maximum batch size that could be used during dynamic adjustment.
	MaxBatchSize *big.Int `mapstructure:"maxBatchSize" yaml:"maxBatchSize" json:"maxBatchSize"`

	// MinBatchSize is the minimum batch size that could be used during dynamic adjustment.
	MinBatchSize *big.Int `mapstructure:"minBatchSize" yaml:"minBatchSize" json:"minBatchSize"`
}

StreamOptions represents the configuration for hypersync event streaming.

func DefaultStreamOptions

func DefaultStreamOptions() *StreamOptions

func DefaultStreamOptionsWithBatchSize

func DefaultStreamOptionsWithBatchSize(batchSize *big.Int) *StreamOptions

func (*StreamOptions) Validate

func (s *StreamOptions) Validate() error

Jump to

Keyboard shortcuts

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