loader

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexTracker

type IndexTracker interface {
	ReadCounter
	Index() (index.Index, error)
}

An IndexTracker tracks the records loaded/written, calculate an index based on them.

func TeeingLinkSystem

func TeeingLinkSystem(ls ipld.LinkSystem, w io.Writer, initialOffset uint64, indexCodec multicodec.Code) (ipld.LinkSystem, IndexTracker)

TeeingLinkSystem wraps an IPLD.LinkSystem so that each time a block is loaded from it, that block is also written as a CAR block to the provided io.Writer. Metadata (the size of data written) is provided in the second return value. The `initialOffset` is used to calculate the offsets recorded for the index, and will be

included in the `.Size()` of the IndexTracker.

An indexCodec of `index.CarIndexNoIndex` can be used to not track these offsets.

type ReadCounter

type ReadCounter interface {
	Size() uint64
}

ReadCounter provides an externally consumable interface to the additional data tracked about the linksystem.

func CountingLinkSystem

func CountingLinkSystem(ls ipld.LinkSystem) (ipld.LinkSystem, ReadCounter)

CountingLinkSystem wraps an ipld linksystem with to track the size of data loaded in a `counter` object. Each time nodes are loaded from the link system which trigger block reads, the size of the block as it would appear in a CAR file is added to the counter (included the size of the CID and the varint length for the block data).

Jump to

Keyboard shortcuts

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