Documentation
¶
Index ¶
- func IsMissing(err error) ([]cid.Cid, bool)
- type ChildLink
- type ExtractingCarReader
- type Extractor
- func (e *Extractor) Close() error
- func (e *Extractor) IsProcessed(c cid.Cid) bool
- func (e *Extractor) OnFileComplete(cb FileProgressCallback)
- func (e *Extractor) OnFileProgress(cb FileProgressCallback)
- func (e *Extractor) OnFileStart(cb FileProgressCallback)
- func (e *Extractor) ProcessBlock(ctx context.Context, block blocks.Block) ([]cid.Cid, error)
- func (e *Extractor) SetRootPath(rootCid cid.Cid, name string)
- type FileProgressCallback
- type IncompleteError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExtractingCarReader ¶
type ExtractingCarReader struct {
// contains filtered or unexported fields
}
ExtractingCarReader reads a CAR stream and extracts UnixFS content directly to disk without storing blocks in memory. It uses a frontier-based approach to track expected blocks and verify the DAG is complete.
func NewExtractingCarReader ¶
func NewExtractingCarReader(ext *Extractor, rootCid cid.Cid) *ExtractingCarReader
NewExtractingCarReader creates a reader that extracts from a CAR stream.
func (*ExtractingCarReader) OnBlock ¶
func (r *ExtractingCarReader) OnBlock(cb func(int))
OnBlock registers a callback invoked for each block processed.
func (*ExtractingCarReader) ReadAndExtract ¶
func (r *ExtractingCarReader) ReadAndExtract(ctx context.Context, rdr io.Reader) (uint64, uint64, error)
ReadAndExtract reads the CAR stream and extracts content to disk. Returns the number of blocks and bytes processed.
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor handles streaming extraction of UnixFS content to disk. It processes blocks one at a time and writes file/directory content as it arrives, without buffering entire files in memory.
func (*Extractor) IsProcessed ¶
IsProcessed returns true if the block has already been processed.
func (*Extractor) OnFileComplete ¶
func (e *Extractor) OnFileComplete(cb FileProgressCallback)
OnFileComplete sets a callback invoked when a file extraction finishes.
func (*Extractor) OnFileProgress ¶
func (e *Extractor) OnFileProgress(cb FileProgressCallback)
OnFileProgress sets a callback invoked when file data is written.
func (*Extractor) OnFileStart ¶
func (e *Extractor) OnFileStart(cb FileProgressCallback)
OnFileStart sets a callback invoked when a file extraction begins.
func (*Extractor) ProcessBlock ¶
ProcessBlock decodes a block and processes it according to its UnixFS type. Returns child CIDs that should be fetched next.
type FileProgressCallback ¶
FileProgressCallback is called when file extraction progress is made. path is relative to output dir, written is bytes written so far, total is expected size (-1 if unknown).
type IncompleteError ¶
IncompleteError indicates the CAR stream ended before all expected blocks were received. The Missing field contains CIDs that were not found.
func (*IncompleteError) Error ¶
func (e *IncompleteError) Error() string