blocks

package
v1.7.0-alpha.1-nomain Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValidityNotDecided = errors.New("block validity undecided")

Functions

func Add

func Add(db sql.Executor, block *types.Block) error

Add block to the database.

func ContextualValidity

func ContextualValidity(db sql.Executor, lid types.LayerID) ([]types.BlockContextualValidity, error)

ContextualValidity returns tuples with block id and contextual validity for all blocks in the layer.

func Get

func Get(db sql.Executor, id types.BlockID) (rst *types.Block, err error)

Get block with id from database.

func GetBlobSizes added in v1.4.1

func GetBlobSizes(db sql.Executor, ids [][]byte) (sizes []int, err error)

GetBlobSizes returns the sizes of the blobs corresponding to blocks with specified ids. For non-existent balots, the corresponding items are set to -1.

func GetLayer

func GetLayer(db sql.Executor, id types.BlockID) (types.LayerID, error)

GetLayer returns the layer of a block.

func Has

func Has(db sql.Executor, id types.BlockID) (bool, error)

Has a block in the database.

func IDsInLayer

func IDsInLayer(db sql.Executor, lid types.LayerID) ([]types.BlockID, error)

IDsInLayer returns list of block ids in the layer.

func IsValid

func IsValid(db sql.Executor, id types.BlockID) (rst bool, err error)

IsValid returns true if block is verified.

func LastValid added in v1.4.0

func LastValid(db sql.Executor) (types.LayerID, error)

func Layer

func Layer(db sql.Executor, lid types.LayerID) ([]*types.Block, error)

Layer returns full body blocks for layer.

func LoadBlob added in v1.4.1

func LoadBlob(ctx context.Context, db sql.Executor, id []byte, b *sql.Blob) error

LoadBlob loads block as an encoded blob, ready to be sent over the wire.

func SetInvalid

func SetInvalid(db sql.Executor, id types.BlockID) error

SetInvalid updates blocks to an invalid status.

func SetValid

func SetValid(db sql.Executor, id types.BlockID) error

SetValid updates verified status for a block.

func UpdateValid

func UpdateValid(db sql.Executor, id types.BlockID, valid bool) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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