blockmeta

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 28 Imported by: 3

README

blockmeta

reference License

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

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 dfuse 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 ErrDBOutOfSync = errors.New("database is out of sync")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func NewServer

func NewServer(
	addr string,
	blockstreamAddr string,
	blocksStore dstore.Store,
	db BlockmetaDB,
	upstreamEOSAPIs []*eos.API,
	extraEOSAPIs []*eos.API,
	protocol pbbstream.Protocol) *server

func Timestamp

func Timestamp(ts *tspb.Timestamp) time.Time

func TimestampProto

func TimestampProto(t time.Time) *tspb.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