piecestore

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0, MIT Imports: 9 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CIDInfoUndefined = CIDInfo{}

CIDInfoUndefined is cid info with no information

View Source
var DSCIDPrefix = "/cid-infos"

DSCIDPrefix is the name space for storing CID infos

View Source
var DSPiecePrefix = "/pieces"

DSPiecePrefix is the name space for storing piece infos

View Source
var PieceInfoUndefined = PieceInfo{}

PieceInfoUndefined is piece info with no information

Functions

This section is empty.

Types

type BlockLocation

type BlockLocation struct {
	RelOffset uint64
	BlockSize uint64
}

BlockLocation is information about where a given block is relative to the overall piece

func (*BlockLocation) MarshalCBOR

func (t *BlockLocation) MarshalCBOR(w io.Writer) error

func (*BlockLocation) UnmarshalCBOR

func (t *BlockLocation) UnmarshalCBOR(r io.Reader) error

type CIDInfo

type CIDInfo struct {
	CID                 cid.Cid
	PieceBlockLocations []PieceBlockLocation
}

CIDInfo is information about where a given CID will live inside a piece

func (*CIDInfo) MarshalCBOR

func (t *CIDInfo) MarshalCBOR(w io.Writer) error

func (*CIDInfo) UnmarshalCBOR

func (t *CIDInfo) UnmarshalCBOR(r io.Reader) error

type DealInfo

type DealInfo struct {
	DealID   abi.DealID
	SectorID uint64
	Offset   uint64
	Length   uint64
}

DealInfo is information about a single deal for a give piece

func (*DealInfo) MarshalCBOR

func (t *DealInfo) MarshalCBOR(w io.Writer) error

func (*DealInfo) UnmarshalCBOR

func (t *DealInfo) UnmarshalCBOR(r io.Reader) error

type PieceBlockLocation

type PieceBlockLocation struct {
	BlockLocation
	PieceCID cid.Cid
}

PieceBlockLocation is block information along with the pieceCID of the piece the block is inside of

func (*PieceBlockLocation) MarshalCBOR

func (t *PieceBlockLocation) MarshalCBOR(w io.Writer) error

func (*PieceBlockLocation) UnmarshalCBOR

func (t *PieceBlockLocation) UnmarshalCBOR(r io.Reader) error

type PieceInfo

type PieceInfo struct {
	PieceCID cid.Cid
	Deals    []DealInfo
}

PieceInfo is metadata about a piece a provider may be storing based on its PieceCID -- so that, given a pieceCID during retrieval, the miner can determine how to unseal it if needed

func (*PieceInfo) MarshalCBOR

func (t *PieceInfo) MarshalCBOR(w io.Writer) error

func (*PieceInfo) UnmarshalCBOR

func (t *PieceInfo) UnmarshalCBOR(r io.Reader) error

type PieceStore

type PieceStore interface {
	AddDealForPiece(pieceCID cid.Cid, dealInfo DealInfo) error
	AddPieceBlockLocations(pieceCID cid.Cid, blockLocations map[cid.Cid]BlockLocation) error
	GetPieceInfo(pieceCID cid.Cid) (PieceInfo, error)
	GetCIDInfo(payloadCID cid.Cid) (CIDInfo, error)
}

PieceStore is a saved database of piece info that can be modified and queried

func NewPieceStore

func NewPieceStore(ds datastore.Batching) PieceStore

NewPieceStore returns a new piecestore based on the given datastore

Jump to

Keyboard shortcuts

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