block

package
v0.0.0-...-8401909 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package block provides the core business API of handling everything block related.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

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

Core manages the set of API's for block access.

func NewCore

func NewCore(log *zap.SugaredLogger, couchClient *kivik.Client, dbName string) Core

NewCore constructs a core for block api access.

func (Core) AddBlock

func (c Core) AddBlock(ctx context.Context, block db.NewBlock) (string, string, error)

func (Core) AddBlocks

func (c Core) AddBlocks(ctx context.Context, blocks []db.Block) (bool, error)

func (Core) GetBlockByHash

func (c Core) GetBlockByHash(ctx context.Context, blockHash string) (db.Block, error)

func (Core) GetBlockByNum

func (c Core) GetBlockByNum(ctx context.Context, blockNum uint64) (db.Block, error)

func (Core) GetBlockTxnSpeed

func (c Core) GetBlockTxnSpeed(ctx context.Context) (float64, error)

func (Core) GetBlocksPagination

func (c Core) GetBlocksPagination(ctx context.Context, latestBlockNum int64, order string, pageNo int64, limit int64) ([]db.Block, int64, int64, error)

func (Core) GetEarliestSyncedRoundNumber

func (c Core) GetEarliestSyncedRoundNumber(ctx context.Context) (uint64, error)

func (Core) GetLastSyncedRoundNumber

func (c Core) GetLastSyncedRoundNumber(ctx context.Context) (uint64, bool, error)

func (Core) GetLatestBlock

func (c Core) GetLatestBlock(ctx context.Context) (db.Block, error)

func (Core) GetNumOfBlocks

func (c Core) GetNumOfBlocks(ctx context.Context) (int64, error)

Directories

Path Synopsis
Package db contains block related CRUD functionality.
Package db contains block related CRUD functionality.

Jump to

Keyboard shortcuts

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