indexbs

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockstoreOpGet     = true
	BlockstoreOpGetSize = !BlockstoreOpGet
)

Variables

View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var ErrNoShardSelected = errors.New("no shard selected")

ErrNoShardSelected means that the shard selection function rejected all of the given shards.

Functions

func NewIndexBackedBlockstore

func NewIndexBackedBlockstore(ctx context.Context, d IdxBstoreDagstore, shardSelector ShardSelectorF, maxCacheSize int, cacheExpire time.Duration) (blockstore.Blockstore, error)

Types

type BlockstoreOp

type BlockstoreOp bool

func (BlockstoreOp) String

func (o BlockstoreOp) String() string

type IdxBstoreDagstore

type IdxBstoreDagstore interface {
	ShardsContainingCid(ctx context.Context, c cid.Cid) ([]shard.Key, error)
	AcquireShard(ctx context.Context, key shard.Key, out chan dagstore.ShardResult, _ dagstore.AcquireOpts) error
}

type IdxBstoreDagstoreFromDagstore

type IdxBstoreDagstoreFromDagstore struct {
	dagstore.Interface
}

func (*IdxBstoreDagstoreFromDagstore) ShardsContainingCid

func (d *IdxBstoreDagstoreFromDagstore) ShardsContainingCid(ctx context.Context, c cid.Cid) ([]shard.Key, error)

type IndexBackedBlockstore

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

IndexBackedBlockstore is a read only blockstore over all cids across all shards in the dagstore.

func (*IndexBackedBlockstore) AllKeysChan

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

func (*IndexBackedBlockstore) DeleteBlock

func (ro *IndexBackedBlockstore) DeleteBlock(context.Context, cid.Cid) error

--- UNSUPPORTED BLOCKSTORE METHODS -------

func (*IndexBackedBlockstore) Get

func (ro *IndexBackedBlockstore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)

func (*IndexBackedBlockstore) GetSize

func (ro *IndexBackedBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error)

func (*IndexBackedBlockstore) Has

func (ro *IndexBackedBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)

func (*IndexBackedBlockstore) HashOnRead

func (ro *IndexBackedBlockstore) HashOnRead(_ bool)

func (*IndexBackedBlockstore) Put

func (*IndexBackedBlockstore) PutMany

type ShardSelectorF

type ShardSelectorF func(c cid.Cid, shards []shard.Key) (shard.Key, error)

ShardSelectorF helps select a shard to fetch a cid from if the given cid is present in multiple shards. It should return `ErrNoShardSelected` if none of the given shard is selected.

Jump to

Keyboard shortcuts

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