pieceio

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0, MIT Imports: 13 Imported by: 0

README

pieceio

The pieceio module is a collection of structs for generating piece commitments (a.k.a. CommP) and storing pieces for storage market deals. It is used by the storagemarket module.

Installation

go get github.com/filecoin-project/go-fil-markets/pieceio

PieceIO

PieceIO is used by storagemarket client for proposing deals.

To initialize a PieceIO:

package pieceio

func NewPieceIO(carIO CarIO, bs blockstore.Blockstore) PieceIO

Parameters

PieceIOWithStore

PieceIOWithStore is PieceIO with a filestore. It is used by storagemarket provider to store pieces, and to generate and store piece commitments and piece metadata for deals.

To initialize a PieceIOWithStore:

package pieceio

func NewPieceIOWithStore(carIO CarIO, store filestore.FileStore, bs blockstore.Blockstore) PieceIOWithStore

Parameters

CarIO

CarIO is a utility module that wraps github.com/ipld/go-car for use by storagemarket.

To initialize a CarIO:

package cario

func NewCarIO() pieceio.CarIO

Please the tests for more information about expected behavior.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePieceCommitment

func GeneratePieceCommitment(rt abi.RegisteredSealProof, rd io.Reader, pieceSize uint64) (cid.Cid, abi.UnpaddedPieceSize, error)

Types

type CarIO

type CarIO interface {
	// WriteCar writes a given payload to a CAR file and into the passed IO stream
	WriteCar(ctx context.Context, bs ReadStore, payloadCid cid.Cid, node ipld.Node, w io.Writer, userOnNewCarBlocks ...car.OnNewCarBlockFunc) error

	// PrepareCar prepares a car so that its total size can be calculated without writing it to a file.
	// It can then be written with PreparedCar.Dump
	PrepareCar(ctx context.Context, bs ReadStore, payloadCid cid.Cid, node ipld.Node) (PreparedCar, error)

	// LoadCar loads blocks into the a store from a given CAR file
	LoadCar(bs WriteStore, r io.Reader) (cid.Cid, error)
}

type PieceIO

type PieceIO interface {
	GeneratePieceCommitment(rt abi.RegisteredSealProof, payloadCid cid.Cid, selector ipld.Node) (cid.Cid, abi.UnpaddedPieceSize, error)
	ReadPiece(r io.Reader) (cid.Cid, error)
}

PieceIO converts between payloads and pieces

func NewPieceIO

func NewPieceIO(carIO CarIO, bs blockstore.Blockstore) PieceIO

type PieceIOWithStore

type PieceIOWithStore interface {
	PieceIO
	GeneratePieceCommitmentToFile(rt abi.RegisteredSealProof, payloadCid cid.Cid, selector ipld.Node, userOnNewCarBlocks ...car.OnNewCarBlockFunc) (cid.Cid, filestore.Path, abi.UnpaddedPieceSize, error)
}

func NewPieceIOWithStore

func NewPieceIOWithStore(carIO CarIO, store filestore.FileStore, bs blockstore.Blockstore) PieceIOWithStore

type PreparedCar

type PreparedCar interface {
	Size() uint64
	Dump(w io.Writer) error
}

type ReadStore

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

type WriteStore

type WriteStore interface {
	Put(blocks.Block) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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