blockstore

package
v0.0.0-...-0939e29 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GobLineToBlock

func GobLineToBlock(line []byte) (*chain.Block, error)

func NewChunk

func NewChunk(name string) (*chunk, error)

Types

type BlockStore

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

func NewBlockStore

func NewBlockStore(ctx context.Context, cfg config.BlockStore, chainId string) *BlockStore

If chainId != "" then blocks until missing chunks are downloaded from remote repository to local folder. During the download the hashes of the remote chunks are checked.

TODO(freki): Make sure that public functions return sane results for null. TODO(freki): Log if blockstore is created or not and what the latest height there is. TODO(freki): Read acceptable hash values for this specific chainId

func (*BlockStore) Close

func (b *BlockStore) Close()

func (*BlockStore) DumpBlock

func (b *BlockStore) DumpBlock(block *chain.Block, forceFinalizeChunk bool)

func (*BlockStore) FistFetchedHeight

func (b *BlockStore) FistFetchedHeight() (int64, error)

func (*BlockStore) HasHeight

func (b *BlockStore) HasHeight(height int64) bool

func (*BlockStore) Iterator

func (b *BlockStore) Iterator(startHeight int64) Iterator

func (*BlockStore) LastFetchedHeight

func (b *BlockStore) LastFetchedHeight() int64

func (*BlockStore) SingleBlock

func (b *BlockStore) SingleBlock(height int64) (*chain.Block, error)

type Iterator

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

func (*Iterator) Next

func (it *Iterator) Next() (*chain.Block, error)

Jump to

Keyboard shortcuts

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