fastsync

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoBlockRequest module.ProtocolInfo = iota << 8
	ProtoBlockMetadata
	ProtoBlockData
	ProtoCancelAllBlockRequests
)

TODO: close message

Variables

This section is empty.

Functions

func FetchBlockByHeightAndHash added in v1.2.11

func FetchBlockByHeightAndHash(
	fsm Manager, h int64, hash []byte, cancelCh <-chan struct{},
) (module.BlockData, []byte, error)

Types

type BlockData

type BlockData struct {
	RequestID uint32
	Data      []byte
}

type BlockMetadata

type BlockMetadata struct {
	RequestID   uint32
	BlockLength int32 // -1 if fails
	Proof       []byte
}

type BlockProofProvider

type BlockProofProvider interface {
	GetBlockProof(h int64, opt int32) (proof []byte, err error)
}

type BlockRequest

type BlockRequest = BlockRequestV2

func (*BlockRequest) RLPDecodeSelf

func (m *BlockRequest) RLPDecodeSelf(d codec.Decoder) error

func (*BlockRequest) RLPEncodeSelf

func (m *BlockRequest) RLPEncodeSelf(e codec.Encoder) error

type BlockRequestV1

type BlockRequestV1 struct {
	RequestID uint32
	Height    int64
}

type BlockRequestV2

type BlockRequestV2 struct {
	RequestID   uint32
	Height      int64
	ProofOption int32
}

type BlockResult

type BlockResult interface {
	Block() module.BlockData
	Votes() []byte
	Consume()
	Reject()
}

type CancelAllBlockRequests

type CancelAllBlockRequests struct {
}

type FetchCallback

type FetchCallback interface {
	OnBlock(br BlockResult)
	OnEnd(err error)
}

type Manager

type Manager interface {
	StartServer()
	StopServer()
	FetchBlocks(
		begin int64,
		end int64,
		cb FetchCallback,
	) (canceler func() bool, err error)
	Term()
}

func NewManager

func NewManager(
	nm module.NetworkManager,
	bm module.BlockManager,
	bpp BlockProofProvider,
	logger log.Logger,
) (Manager, error)

func NewManagerOnlyForClient added in v1.2.11

func NewManagerOnlyForClient(
	nm module.NetworkManager,
	bdf module.BlockDataFactory,
	logger log.Logger,
) (Manager, error)

type MessageItem

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

type ServerCallback

type ServerCallback interface {
	OnBeginServing(id module.PeerID)
	OnEndServing(id module.PeerID)
}

Jump to

Keyboard shortcuts

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