downloader

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

package downloader contains a cache for downloading blocks from a renterd node. A cache optimizes the number of in-flight requests to avoid overloading the node and caches blocks to avoid redundant downloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDownloader

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

BlockDownloader is a cache for downloading blocks from a renterd node. It limits the number of in-flight requests to avoid overloading the node and caches blocks to avoid redundant downloads.

For UnixFS nodes, it also prefetches linked blocks.

func NewBlockDownloader

func NewBlockDownloader(ctx core.Context, store MetadataStore, workers int) (*BlockDownloader, error)

NewBlockDownloader creates a new BlockDownloader.

func (*BlockDownloader) Get

func (bd *BlockDownloader) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)

Get returns a block by CID.

type MetadataStore

type MetadataStore interface {
	BlockExists(c cid.Cid) (err error)
	BlockSiblings(c cid.Cid, max int) (siblings []cid.Cid, err error)
	BlockChildren(c cid.Cid, max *int) (siblings []cid.Cid, err error)
}

A MetadataStore is a store for IPFS block metadata. It is used to optimize block downloads by prefetching linked blocks.

Jump to

Keyboard shortcuts

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