core

package
v0.0.0-...-7027883 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlockstore

func NewBlockstore(dstore datastore.Batching, url string) (blockstore.Blockstore, error)

Types

type Blockstore

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

func (*Blockstore) AllKeysChan

func (b *Blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)

AllKeysChan returns a channel from which the CIDs in the Blockstore can be read. It should respect the given context, closing the channel if it becomes Done.

func (*Blockstore) DeleteBlock

func (b *Blockstore) DeleteBlock(ctx context.Context, id cid.Cid) error

func (*Blockstore) Get

func (b *Blockstore) Get(ctx context.Context, id cid.Cid) (blocks.Block, error)

func (*Blockstore) GetSize

func (b *Blockstore) GetSize(ctx context.Context, id cid.Cid) (int, error)

GetSize returns the CIDs mapped BlockSize

func (*Blockstore) Has

func (b *Blockstore) Has(ctx context.Context, id cid.Cid) (bool, error)

func (*Blockstore) HashOnRead

func (b *Blockstore) HashOnRead(enabled bool)

HashOnRead specifies if every read block should be rehashed to make sure it matches its CID.

func (*Blockstore) Put

func (b *Blockstore) Put(ctx context.Context, blk blocks.Block) error

Put puts a given block to the underlying datastore

func (*Blockstore) PutMany

func (b *Blockstore) PutMany(ctx context.Context, blks []blocks.Block) error

PutMany puts a slice of blocks at the same time using batching capabilities of the underlying datastore whenever possible.

type Bridge

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

func NewBridge

func NewBridge(bstore blockstore.Blockstore, url string) (*Bridge, error)

func (*Bridge) PutBlock

func (b *Bridge) PutBlock(ctx context.Context, block *types.Block) error

func (*Bridge) PutHeader

func (b *Bridge) PutHeader(ctx context.Context, header *types.Header) error

func (*Bridge) PutHeaderList

func (b *Bridge) PutHeaderList(ctx context.Context, list []*types.Header) error

func (*Bridge) PutTransactions

func (b *Bridge) PutTransactions(ctx context.Context, txs types.Transactions) (common.Hash, error)

func (*Bridge) Sync

func (b *Bridge) Sync(ctx context.Context, id cid.Cid) error

Sync ensures the blockstore has the block with the given CID.

type Node

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

func NewNode

func NewNode(ctx context.Context, cfg config.Config) (*Node, error)

func (*Node) GetBlockByHash

func (n *Node) GetBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*Node) GetHeaderByHash

func (n *Node) GetHeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*Node) GetHeaderList

func (n *Node) GetHeaderList(ctx context.Context, hash common.Hash) ([]*types.Header, error)

func (*Node) GetReceipts

func (n *Node) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*Node) GetTransactions

func (n *Node) GetTransactions(ctx context.Context, hash common.Hash) (types.Transactions, error)

func (*Node) PeerId

func (n *Node) PeerId() string

Jump to

Keyboard shortcuts

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