protocol

package
v0.35.15-crescendo-pre... Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBlockSignerDecoder

func WithBlockSignerDecoder(signerIndicesDecoder hotstuff.BlockSignerDecoder) func(*Handler)

Types

type API

type API interface {
	NetworkAPI
	GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flow.Header, error)
	GetBlockHeaderByID(ctx context.Context, id flow.Identifier) (*flow.Header, error)
	GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flow.Header, error)
	GetLatestBlock(ctx context.Context, isSealed bool) (*flow.Block, error)
	GetBlockByID(ctx context.Context, id flow.Identifier) (*flow.Block, error)
	GetBlockByHeight(ctx context.Context, height uint64) (*flow.Block, error)
}

func New

func New(
	state protocol.State,
	blocks storage.Blocks,
	headers storage.Headers,
	network NetworkAPI,
) API

type Handler

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

func NewHandler

func NewHandler(api API, options ...HandlerOption) *Handler

func (*Handler) GetBlockByHeight

func (h *Handler) GetBlockByHeight(
	ctx context.Context,
	req *access.GetBlockByHeightRequest,
) (*access.BlockResponse, error)

GetBlockByHeight gets a block by height.

func (*Handler) GetBlockByID

func (h *Handler) GetBlockByID(
	ctx context.Context,
	req *access.GetBlockByIDRequest,
) (*access.BlockResponse, error)

GetBlockByID gets a block by ID.

func (*Handler) GetBlockHeaderByHeight

func (h *Handler) GetBlockHeaderByHeight(
	ctx context.Context,
	req *access.GetBlockHeaderByHeightRequest,
) (*access.BlockHeaderResponse, error)

GetBlockHeaderByHeight gets a block header by height.

func (*Handler) GetBlockHeaderByID

func (h *Handler) GetBlockHeaderByID(
	ctx context.Context,
	req *access.GetBlockHeaderByIDRequest,
) (*access.BlockHeaderResponse, error)

GetBlockHeaderByID gets a block header by ID.

func (*Handler) GetLatestBlock

func (h *Handler) GetLatestBlock(
	ctx context.Context,
	req *access.GetLatestBlockRequest,
) (*access.BlockResponse, error)

GetLatestBlock gets the latest sealed block.

func (*Handler) GetLatestBlockHeader

func (h *Handler) GetLatestBlockHeader(
	ctx context.Context,
	req *access.GetLatestBlockHeaderRequest,
) (*access.BlockHeaderResponse, error)

GetLatestBlockHeader gets the latest sealed block header.

func (*Handler) GetLatestProtocolStateSnapshot

GetLatestProtocolStateSnapshot returns the latest serializable Snapshot

func (*Handler) GetNodeVersionInfo added in v0.31.0

func (h *Handler) GetNodeVersionInfo(
	ctx context.Context,
	request *access.GetNodeVersionInfoRequest,
) (*access.GetNodeVersionInfoResponse, error)

func (*Handler) GetProtocolStateSnapshotByBlockID added in v0.33.1

GetProtocolStateSnapshotByBlockID returns serializable Snapshot by blockID

func (*Handler) GetProtocolStateSnapshotByHeight added in v0.33.1

GetProtocolStateSnapshotByHeight returns serializable Snapshot by block height

type HandlerOption

type HandlerOption func(*Handler)

HandlerOption is used to hand over optional constructor parameters

type NetworkAPI

type NetworkAPI interface {
	GetNetworkParameters(ctx context.Context) access.NetworkParameters
	GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error)
	GetProtocolStateSnapshotByBlockID(ctx context.Context, blockID flow.Identifier) ([]byte, error)
	GetProtocolStateSnapshotByHeight(ctx context.Context, blockHeight uint64) ([]byte, error)
	GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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