blockfetch

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL_NAME        = "block-fetch"
	PROTOCOL_ID   uint16 = 3
)
View Source
const (
	MESSAGE_TYPE_REQUEST_RANGE = 0
	MESSAGE_TYPE_CLIENT_DONE   = 1
	MESSAGE_TYPE_START_BATCH   = 2
	MESSAGE_TYPE_NO_BLOCKS     = 3
	MESSAGE_TYPE_BLOCK         = 4
	MESSAGE_TYPE_BATCH_DONE    = 5
)

Variables

View Source
var (
	STATE_IDLE      = protocol.NewState(1, "Idle")
	STATE_BUSY      = protocol.NewState(2, "Busy")
	STATE_STREAMING = protocol.NewState(3, "Streaming")
	STATE_DONE      = protocol.NewState(4, "Done")
)

Functions

func NewMsgFromCbor added in v0.5.0

func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)

Types

type BatchDoneFunc added in v0.18.0

type BatchDoneFunc func() error

type BlockFetch

type BlockFetch struct {
	Client *Client
	Server *Server
}

func New

func New(protoOptions protocol.ProtocolOptions, cfg *Config) *BlockFetch

type BlockFetchOptionFunc added in v0.25.0

type BlockFetchOptionFunc func(*Config)

func WithBatchDoneFunc added in v0.25.0

func WithBatchDoneFunc(BatchDoneFunc BatchDoneFunc) BlockFetchOptionFunc

func WithBatchStartTimeout added in v0.25.0

func WithBatchStartTimeout(timeout time.Duration) BlockFetchOptionFunc

func WithBlockFunc added in v0.25.0

func WithBlockFunc(blockFunc BlockFunc) BlockFetchOptionFunc

func WithBlockTimeout added in v0.25.0

func WithBlockTimeout(timeout time.Duration) BlockFetchOptionFunc

func WithNoBlocksFunc added in v0.25.0

func WithNoBlocksFunc(noBlocksFunc NoBlocksFunc) BlockFetchOptionFunc

func WithStartBatchFunc added in v0.25.0

func WithStartBatchFunc(startBatchFunc StartBatchFunc) BlockFetchOptionFunc

type BlockFunc added in v0.18.0

type BlockFunc func(uint, interface{}) error

type Client added in v0.19.0

type Client struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

func NewClient added in v0.19.0

func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client

func (*Client) ClientDone added in v0.19.0

func (c *Client) ClientDone() error

func (*Client) RequestRange added in v0.19.0

func (c *Client) RequestRange(start []interface{}, end []interface{}) error

type Config added in v0.18.0

type Config struct {
	StartBatchFunc    StartBatchFunc
	NoBlocksFunc      NoBlocksFunc
	BlockFunc         BlockFunc
	BatchDoneFunc     BatchDoneFunc
	BatchStartTimeout time.Duration
	BlockTimeout      time.Duration
}

func NewConfig added in v0.25.0

func NewConfig(options ...BlockFetchOptionFunc) Config

type MsgBatchDone added in v0.10.0

type MsgBatchDone struct {
	protocol.MessageBase
}

func NewMsgBatchDone added in v0.12.1

func NewMsgBatchDone() *MsgBatchDone

type MsgBlock added in v0.10.0

type MsgBlock struct {
	protocol.MessageBase
	WrappedBlock []byte
}

func NewMsgBlock added in v0.12.1

func NewMsgBlock(wrappedBlock []byte) *MsgBlock

type MsgClientDone added in v0.10.0

type MsgClientDone struct {
	protocol.MessageBase
}

func NewMsgClientDone added in v0.10.0

func NewMsgClientDone() *MsgClientDone

type MsgNoBlocks added in v0.10.0

type MsgNoBlocks struct {
	protocol.MessageBase
}

func NewMsgNoBlocks added in v0.12.1

func NewMsgNoBlocks() *MsgNoBlocks

type MsgRequestRange added in v0.10.0

type MsgRequestRange struct {
	protocol.MessageBase
	Start interface{} //point
	End   interface{} //point
}

func NewMsgRequestRange added in v0.10.0

func NewMsgRequestRange(start interface{}, end interface{}) *MsgRequestRange

type MsgStartBatch added in v0.10.0

type MsgStartBatch struct {
	protocol.MessageBase
}

func NewMsgStartBatch added in v0.12.1

func NewMsgStartBatch() *MsgStartBatch

type NoBlocksFunc added in v0.18.0

type NoBlocksFunc func() error

type Server added in v0.19.0

type Server struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

func NewServer added in v0.19.0

func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server

type StartBatchFunc added in v0.18.0

type StartBatchFunc func() error

Callback function types

type WrappedBlock added in v0.10.0

type WrappedBlock struct {
	Type     uint
	RawBlock cbor.RawMessage
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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