blobindex

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(model ShardedDagIndex) (io.Reader, error)

Archive writes a ShardedDagIndex to a CAR file

func View

func View(root ipld.Link, blockMap map[ipld.Link]ipld.Block) (ShardedDagIndexView, ExtractError)

Types

type DecodeFailureErorr

type DecodeFailureErorr struct {
	failure.NamedWithStackTrace
	// contains filtered or unexported fields
}

DecodeFailureErorr indicates an error in the structure of the ShardedDagIndex

func (DecodeFailureErorr) Error

func (dfe DecodeFailureErorr) Error() string

func (DecodeFailureErorr) Unwrap

func (dfe DecodeFailureErorr) Unwrap() error

type ExtractError

type ExtractError interface {
	error
	// contains filtered or unexported methods
}

ExtractError is a union type of UnknownFormatError and DecodeFailureErorr

func NewDecodeFailureError

func NewDecodeFailureError(reason error) ExtractError

NewDecodeFailureError returns an ExtractError for a decode failure

func NewUnknownFormatError

func NewUnknownFormatError(reason error) ExtractError

NewUnknownFormatError returns an ExtractError for an unknown format

type MultihashMap

type MultihashMap[T any] interface {
	Get(mh.Multihash) T
	Has(mh.Multihash) bool
	Set(mh.Multihash, T)
	Delete(mh.Multihash) bool
	Size() int
	Iterator() iter.Seq2[mh.Multihash, T]
}

MultihashMap is a generic for mapping multihashes to arbitrary data types

func NewMultihashMap

func NewMultihashMap[T any](sizeHint int) MultihashMap[T]

NewMultihashMap returns a new map of multihash to a data type

type Position

type Position = dm.PositionModel

Position describes an offet and length within a shard

type ShardedDagIndex

type ShardedDagIndex interface {
	/** DAG root CID that the index pertains to. */
	Content() ipld.Link
	/** Index information for shards the DAG is split across. */
	Shards() MultihashMap[MultihashMap[Position]]
}

ShardedDagIndex descriptes a DAG stored over one or multiple shards

type ShardedDagIndexView

type ShardedDagIndexView interface {
	ShardedDagIndex
	SetSlice(shard mh.Multihash, slice mh.Multihash, position Position)
	Archive() (io.Reader, error)
}

ShardedDagIndexView is an interface for building shard DAG indexes and writing them to CAR files

func Extract

func Extract(r io.Reader) (ShardedDagIndexView, error)

Extract extracts a sharded dag index from a car

func FromShardArchives

func FromShardArchives(content ipld.Link, shards [][]byte) (ShardedDagIndexView, error)

FromShardArchives creates a sharded DAG index by indexing blocks in the passed CAR shards.

func NewShardedDagIndexView

func NewShardedDagIndexView(content ipld.Link, shardSizeHint int) ShardedDagIndexView

NewShardedDagIndexView constructs an empty ShardedDagIndexView

  • content sets the content link -- shardSizeHint is used to preallocate the number of shards that will be used. Set to -1 for unknown

type UnknownFormatError

type UnknownFormatError struct {
	failure.NamedWithStackTrace
	// contains filtered or unexported fields
}

UnknownFormatError indicates an error attempting to read the car file

func (UnknownFormatError) Error

func (ufe UnknownFormatError) Error() string

func (UnknownFormatError) Unwrap

func (ufe UnknownFormatError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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