block

package
v0.0.0-...-a4f5bd3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Block

type Block interface {
	Link() ipld.Link
	Bytes() []byte
}

func New

func New(link ipld.Link, bytes []byte) Block

type BlockView

type BlockView[T any] interface {
	Block
	Value() T
}

func NewBlockView

func NewBlockView[T any](link ipld.Link, bytes []byte, value T) BlockView[T]

type Fetcher

type Fetcher interface {
	Get(ctx context.Context, link ipld.Link) (Block, error)
}

type MapBlockstore

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

MapBlockstore is a blockstore that is backed by an in memory map.

func NewMapBlockstore

func NewMapBlockstore() *MapBlockstore

NewMapBlockstore creates a new blockstore that is backed by an in memory map.

func (*MapBlockstore) Del

func (bs *MapBlockstore) Del(ctx context.Context, link ipld.Link) error

func (*MapBlockstore) Get

func (bs *MapBlockstore) Get(ctx context.Context, link ipld.Link) (Block, error)

func (*MapBlockstore) Put

func (bs *MapBlockstore) Put(ctx context.Context, b Block) error

type TieredBlockFetcher

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

TieredBlockFetcher is a Fetcher that attempts to retrieve a block serially from multiple configured fetchers in order, returning the first Block that is returned by a fetcher.

func NewTieredBlockFetcher

func NewTieredBlockFetcher(fetchers ...Fetcher) *TieredBlockFetcher

NewTieredBlockFetcher cretaes a new TieredBlockFetcher - a Fetcher that attempts to retrieve a block serially from multiple configured fetchers in order, returning the first Block that is returned by a fetcher.

func (*TieredBlockFetcher) Get

func (mbf *TieredBlockFetcher) Get(ctx context.Context, link ipld.Link) (Block, error)

Jump to

Keyboard shortcuts

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