blockstore

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidBlockType = errors.New("Invalid block type")

Functions

This section is empty.

Types

type PeergosBlockstore

type PeergosBlockstore struct {
	TypeLimitedBlockstore
	// contains filtered or unexported fields
}

func (*PeergosBlockstore) AllKeysChan

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

func (*PeergosBlockstore) DeleteBlock

func (bs *PeergosBlockstore) DeleteBlock(c cid.Cid) error

func (*PeergosBlockstore) Get

func (bs *PeergosBlockstore) Get(c cid.Cid) (blocks.Block, error)

func (*PeergosBlockstore) GetSize

func (bs *PeergosBlockstore) GetSize(c cid.Cid) (int, error)

func (*PeergosBlockstore) Has

func (bs *PeergosBlockstore) Has(c cid.Cid) (bool, error)

func (*PeergosBlockstore) HashOnRead

func (bs *PeergosBlockstore) HashOnRead(enabled bool)

func (*PeergosBlockstore) Put

func (bs *PeergosBlockstore) Put(b blocks.Block) error

func (*PeergosBlockstore) PutMany

func (bs *PeergosBlockstore) PutMany(blocks []blocks.Block) error

type TypeLimitedBlockstore

type TypeLimitedBlockstore interface {
	DeleteBlock(cid.Cid) error
	Has(cid.Cid) (bool, error)
	Get(cid.Cid) (blocks.Block, error)

	// GetSize returns the CIDs mapped BlockSize
	GetSize(cid.Cid) (int, error)

	// Put puts a given block to the underlying datastore
	Put(blocks.Block) error

	// PutMany puts a slice of blocks at the same time using batching
	// capabilities of the underlying datastore whenever possible.
	PutMany([]blocks.Block) 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.
	AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)

	// HashOnRead specifies if every read block should be
	// rehashed to make sure it matches its CID.
	HashOnRead(enabled bool)
}

func NewPeergosBlockstore

func NewPeergosBlockstore(bstore blockstore.Blockstore) TypeLimitedBlockstore

Jump to

Keyboard shortcuts

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