filecoin

package
v0.0.0-...-d1af7be Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkFIL  = "fil"
	NetworkIPFS = "ipfs"
	NetworkAuto = "auto"
)

Variables

View Source
var ApiURL string = "wss://api.chain.love"

Functions

func Get

func Get(nd *whypfs.Node, cidStr, network, dmSelText string, minerStrings []string) error

Types

type FILRetrievalAttempt

type FILRetrievalAttempt struct {
	FilClient  *filclient.FilClient
	Cid        cid.Cid
	Candidates []FILRetrievalCandidate
	SelNode    ipld.Node

	// Disable sorting of candidates based on preferability
	NoSort bool
}

func (*FILRetrievalAttempt) Retrieve

func (attempt *FILRetrievalAttempt) Retrieve(ctx context.Context, node *whypfs.Node) (RetrievalStats, error)

type FILRetrievalCandidate

type FILRetrievalCandidate struct {
	Miner   address.Address
	RootCid cid.Cid
	DealID  uint
}

func GetRetrievalCandidates

func GetRetrievalCandidates(endpoint string, c cid.Cid) ([]FILRetrievalCandidate, error)

type FILRetrievalStats

type FILRetrievalStats struct {
	filclient.RetrievalStats
}

func (*FILRetrievalStats) GetAverageBytesPerSecond

func (stats *FILRetrievalStats) GetAverageBytesPerSecond() uint64

func (*FILRetrievalStats) GetByteSize

func (stats *FILRetrievalStats) GetByteSize() uint64

func (*FILRetrievalStats) GetDuration

func (stats *FILRetrievalStats) GetDuration() time.Duration

type GetAttempt

type GetAttempt interface {
	Retrieve(context.Context, *whypfs.Node) (RetrievalStats, error)
}

A get attempt is a configuration for performing a specific fetch over a specific network

type IPFSRetrievalAttempt

type IPFSRetrievalAttempt struct {
	Cid cid.Cid
}

func (*IPFSRetrievalAttempt) Retrieve

func (attempt *IPFSRetrievalAttempt) Retrieve(ctx context.Context, node *whypfs.Node) (RetrievalStats, error)

type IPFSRetrievalStats

type IPFSRetrievalStats struct {
	ByteSize uint64
	Duration time.Duration
}

func (*IPFSRetrievalStats) GetAverageBytesPerSecond

func (stats *IPFSRetrievalStats) GetAverageBytesPerSecond() uint64

func (*IPFSRetrievalStats) GetByteSize

func (stats *IPFSRetrievalStats) GetByteSize() uint64

func (*IPFSRetrievalStats) GetDuration

func (stats *IPFSRetrievalStats) GetDuration() time.Duration

type RetrievalStats

type RetrievalStats interface {
	GetByteSize() uint64
	GetDuration() time.Duration
	GetAverageBytesPerSecond() uint64
}

func RetrieveFromBestCandidate

func RetrieveFromBestCandidate(
	node *whypfs.Node,
	ctx context.Context,
	attempts []GetAttempt,
) (RetrievalStats, error)

Takes a list of network configs to attempt to retrieve from, in order. Valid structs for the interface: IPFSRetrievalConfig, FILRetrievalConfig

Jump to

Keyboard shortcuts

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