pack

package
v0.2.28 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0, MIT Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const ChunkSize int64 = 1 << 20
View Source
const NumLinkPerNode = 1024

Variables

View Source
var ErrItemModified = errors.New("item has been modified")

Functions

func AssembleItemFromLinks(links []format.Link) ([]blocks.Block, *merkledag.ProtoNode, error)

AssembleItemFromLinks creates a new UnixFS parent node from child links. This function handles constructing layers of parent nodes. It returns the additional blocks, the root node, and an error if any.

func GenerateCarHeader added in v0.1.0

func GenerateCarHeader(root cid.Cid) ([]byte, error)

func GetBlockStreamFromItem added in v0.1.0

func GetBlockStreamFromItem(ctx context.Context,
	handler datasource.ReadHandler,
	itemPart model.ItemPart,
	encryptor encryption.Encryptor) (<-chan BlockResult, fs.Object, error)

GetBlockStreamFromItem streams an item from the handler and encrypts it. It returns a channel of blocks, the object, and an error if any.

func GetCommp added in v0.1.0

func GetCommp(calc *commp.Calc, targetPieceSize uint64) (cid.Cid, uint64, error)

func GetMultiWriter added in v0.1.0

func GetMultiWriter(outDir string) (io.WriteCloser, *commp.Calc, string, error)

func IsSameEntry added in v0.2.14

func IsSameEntry(ctx context.Context, item model.Item, object fs.Object) (bool, string)

func Min

func Min(i int, i2 int) int

func WriteCarBlock

func WriteCarBlock(writer io.Writer, block blocks.Block) (int64, error)

func WriteCarHeader added in v0.1.0

func WriteCarHeader(writer io.Writer, root cid.Cid) ([]byte, error)

Types

type BlockResult

type BlockResult struct {
	// Offset is the offset of the block in the potentially encrypted stream
	Offset int64
	// Raw is the block data which is potentially encrypted
	Raw []byte
	// CID is the CID of the block
	CID   cid.Cid
	Error error
}

type CarResult added in v0.1.0

type CarResult struct {
	CarFilePath string
	CarFileSize int64
	PieceCID    cid.Cid
	PieceSize   int64
	RootCID     cid.Cid
	Header      []byte
	CarBlocks   []model.CarBlock
}

type Result

type Result struct {
	ItemPartCIDs map[uint64]cid.Cid
	Objects      map[uint64]fs.Object
	CarResults   []CarResult
}

func AssembleCar added in v0.1.0

func AssembleCar(
	ctx context.Context,
	handler datasource.ReadHandler,
	dataset model.Dataset,
	itemParts []model.ItemPart,
	outDir string,
	pieceSize int64,
) (*Result, error)

type WriteCloser added in v0.1.0

type WriteCloser struct {
	io.Writer
	io.Closer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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