protocol

package
v0.28.14 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: AGPL-3.0 Imports: 13 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

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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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