blockmeta

package module
v0.0.2-0...-6ca488c Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

README

StreamingFast Blockmeta

reference License

This service is the spinal cord of a network, regarding network and blocks status. It is part of StreamingFast.

Multiple services rely on this one to have a quick understanding of the state of the chain, blocks, and history from a consensus standpoint.

Installation & Usage

This service has a protocol-specific implementation in its respective repository.

Contributing

Issues and PR in this repo related strictly to the core blockmeta service.

Report any protocol-specific issues in their respective repositories

Please first refer to the general StreamingFast contribution guide, if you wish to contribute to this code base.

License

Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockNumToIDFromAPI func(ctx context.Context, blockNum uint64) (string, error)
View Source
var ErrDBOutOfSync = errors.New("database is out of sync")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var GetBlockNumFromID func(ctx context.Context, id string) (uint64, error)
View Source
var GetHeadInfoFromAPI func(ctx context.Context) (*pbheadinfo.HeadInfoResponse, error)
View Source
var GetIrrIDFromAPI func(ctx context.Context, blockNum uint64, libNum uint64) (string, error)

Functions

func NewServer

func NewServer(
	addr string,
	blockstreamAddr string,
	blocksStore dstore.Store,
	db BlockmetaDB,
	protocol pbbstream.Protocol) *server

func TimestampProto

func TimestampProto(t time.Time) *timestamppb.Timestamp

Types

type BlockmetaDB

type BlockmetaDB interface {
	BlockIDAt(ctx context.Context, start time.Time) (id string, err error)
	BlockIDAfter(ctx context.Context, start time.Time, inclusive bool) (id string, foundtime time.Time, err error)
	BlockIDBefore(ctx context.Context, start time.Time, inclusive bool) (id string, foundtime time.Time, err error)

	GetLastWrittenBlockID(ctx context.Context) (blockID string, err error)
	GetIrreversibleIDAtBlockNum(ctx context.Context, num uint64) (ref bstream.BlockRef, err error)
	GetIrreversibleIDAtBlockID(ctx context.Context, id string) (ref bstream.BlockRef, err error)

	// GetForkPreviousBlocks will give you the blockrefs of all blocks in this fork.
	// It stops going up when it meets an irreversible block in kvdb, or if a block is unlinkable (previousID not found in db).
	GetForkPreviousBlocks(ctx context.Context, forkTop bstream.BlockRef) ([]bstream.BlockRef, error)
}

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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