carv1

package
v0.8.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 10 Imported by: 0

Documentation

Overview

Forked from CARv1 to avoid dependency to ipld-prime 0.9.0 due to outstanding upgrades in filecoin.

Index

Constants

View Source
const DefaultMaxAllowedHeaderSize uint64 = 32 << 20 // 32MiB
View Source
const DefaultMaxAllowedSectionSize uint64 = 8 << 20 // 8MiB

Variables

This section is empty.

Functions

func HeaderSize

func HeaderSize(h *CarHeader) (uint64, error)

func WriteCar

func WriteCar(ctx context.Context, ds format.NodeGetter, roots []cid.Cid, w io.Writer) error

func WriteHeader

func WriteHeader(h *CarHeader, w io.Writer) error

Types

type CarHeader

type CarHeader struct {
	Roots   []cid.Cid
	Version uint64
}

func LoadCar

func LoadCar(s Store, r io.Reader) (*CarHeader, error)

func ReadHeader

func ReadHeader(r io.Reader, maxReadBytes uint64) (*CarHeader, error)

func ReadHeaderAt

func ReadHeaderAt(at io.ReaderAt, maxReadBytes uint64) (*CarHeader, error)

func (CarHeader) Matches

func (h CarHeader) Matches(other CarHeader) bool

Matches checks whether two headers match. Two headers are considered matching if:

  1. They have the same version number, and
  2. They contain the same root CIDs in any order.

Note, this function explicitly ignores the order of roots. If order of roots matter use reflect.DeepEqual instead.

type CarReader

type CarReader struct {
	Header *CarHeader
	// contains filtered or unexported fields
}

func NewCarReader

func NewCarReader(r io.Reader) (*CarReader, error)

func NewCarReaderWithZeroLengthSectionAsEOF

func NewCarReaderWithZeroLengthSectionAsEOF(r io.Reader) (*CarReader, error)

func NewCarReaderWithoutDefaults

func NewCarReaderWithoutDefaults(r io.Reader, zeroLenAsEOF bool, maxAllowedHeaderSize uint64, maxAllowedSectionSize uint64) (*CarReader, error)

func (*CarReader) Next

func (cr *CarReader) Next() (blocks.Block, error)

type ReadStore

type ReadStore interface {
	Get(context.Context, cid.Cid) (blocks.Block, error)
}

type Store

type Store interface {
	Put(context.Context, blocks.Block) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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