carv1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

helper package for building car file of version 1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockWalk

func BlockWalk(ctx context.Context, node format.Node, bs format.NodeGetter, batchNum int, cb func(nd format.Node) error) error

func GetNode

func GetNode(ctx context.Context, cid cid.Cid, bs blockstore.Blockstore) (format.Node, error)

func NewOfflineNodeGetter added in v0.0.17

func NewOfflineNodeGetter(ng blockstore.Blockstore) *offlineng

func NewOnlineNodeGetter added in v0.0.17

func NewOnlineNodeGetter(ng format.DAGService) *onlineng

func PadCar

func PadCar(w io.Writer, carSize int64) error

func PadCarFile added in v0.0.13

func PadCarFile(targetPath string) error

func UnpadCarFile added in v0.0.13

func UnpadCarFile(targetPath string) error

Types

type BatchBuilder

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

func NewBatch

func NewBatch(ctx context.Context, bs format.NodeGetter) *BatchBuilder

func (*BatchBuilder) Ref added in v0.0.17

func (b *BatchBuilder) Ref(root cid.Cid, batchNum int) (*Carv1Ref, error)

func (*BatchBuilder) Write added in v0.0.12

func (b *BatchBuilder) Write(root cid.Cid, w io.Writer, batchNum int) (uint64, error)

func (*BatchBuilder) WriteToFile added in v0.0.12

func (b *BatchBuilder) WriteToFile(root cid.Cid, outPath string, batchNum int) error

type Carv1Ref added in v0.0.17

type Carv1Ref struct {
	Size    uint64
	DataRef []*DataRef
}

func DecodeCarv1Ref added in v0.0.17

func DecodeCarv1Ref(data []byte) (ref *Carv1Ref, err error)

func (*Carv1Ref) Encode added in v0.0.17

func (cr *Carv1Ref) Encode() ([]byte, error)

type DataRef added in v0.0.17

type DataRef struct {
	Offset uint64
	Size   uint64
	Type   RefType
	Blocks []string
	Block  string
}

type NullReader

type NullReader struct{}

func (NullReader) Read

func (nr NullReader) Read(b []byte) (int, error)

Read writes NUL bytes into the provided byte slice.

type RefType added in v0.0.17

type RefType int8
const (
	RefHeader RefType = iota
	RefData
)

Jump to

Keyboard shortcuts

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