splitcarfetcher

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxIdleConnsPerHost = 100
	DefaultTimeout             = 1000 * time.Second
	DefaultKeepAlive           = 180 * time.Second
)

Functions

func GetContentSizeWithHeadOrZeroRange

func GetContentSizeWithHeadOrZeroRange(url string) (int64, error)

func NewHTTPClient

func NewHTTPClient() *http.Client

NewHTTPClient returns a new Client from the provided config. Client is safe for concurrent use by multiple goroutines.

func NewHTTPTransport

func NewHTTPTransport() *http.Transport

Types

type Deal

type Deal struct {
	Provider       address.Address
	DealUUID       string
	FileName       string
	URL            string
	CommpPieceCID  cid.Cid
	FileSize       int64
	PaddedFileSize int64
	PayloadCID     string
}

provider,deal_uuid,file_name,url,commp_piece_cid,file_size,padded_size,payload_cid

type DealRegistry

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

func DealsFromCSV

func DealsFromCSV(path string) (*DealRegistry, error)

DealsFromCSV reads a CSV file and returns a DealRegistry.

func NewDealRegistry

func NewDealRegistry() *DealRegistry

func (*DealRegistry) GetDeal

func (r *DealRegistry) GetDeal(pieceCID cid.Cid) (Deal, bool)

GetDeal returns the deal associated with the given piece CID.

func (*DealRegistry) GetMinerByPieceCID

func (r *DealRegistry) GetMinerByPieceCID(pieceCID cid.Cid) (address.Address, bool)

GetMinerByPieceCID returns the miner associated with the given piece CID.

type FileSplitCarReader

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

func NewFileSplitCarReader

func NewFileSplitCarReader(filepath string) (*FileSplitCarReader, error)

func (*FileSplitCarReader) Close

func (fscr *FileSplitCarReader) Close() error

func (*FileSplitCarReader) ReadAt

func (fscr *FileSplitCarReader) ReadAt(p []byte, off int64) (n int, err error)

func (*FileSplitCarReader) Size

func (fscr *FileSplitCarReader) Size() int64

type HTTPSingleFileRemoteReaderAt

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

func (*HTTPSingleFileRemoteReaderAt) Close

Close implements io.Closer.

func (*HTTPSingleFileRemoteReaderAt) ReadAt

func (r *HTTPSingleFileRemoteReaderAt) ReadAt(p []byte, off int64) (n int, err error)

func (*HTTPSingleFileRemoteReaderAt) Size

Size returns the size of the file.

type Metadata

type Metadata struct {
	CarPieces *carlet.CarPiecesAndMetadata `yaml:"car_pieces_meta"`
}

func MetadataFromYaml

func MetadataFromYaml(path string) (*Metadata, error)

type MinerInfo

type MinerInfo struct {
	PeerIDEncoded           string `json:"PeerID"`
	PeerID                  peer.ID
	MultiaddrsBase64Encoded []string `json:"Multiaddrs"`
	Multiaddrs              []multiaddr.Multiaddr
}

type MinerInfoCache

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

func NewMinerInfo

func NewMinerInfo(
	lotusClient jsonrpc.RPCClient,
	cacheTTL time.Duration,
	requestTimeout time.Duration,
) *MinerInfoCache

func (*MinerInfoCache) GetProviderInfo

func (d *MinerInfoCache) GetProviderInfo(ctx context.Context, provider address.Address) (*MinerInfo, error)

type MinerInfoFetcher

type MinerInfoFetcher struct {
	Client jsonrpc.RPCClient
}

func (*MinerInfoFetcher) GetProviderInfo

func (m *MinerInfoFetcher) GetProviderInfo(ctx context.Context, provider string) (*MinerInfo, error)

type MultiReaderAt

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

func NewMultiReaderAt

func NewMultiReaderAt(readers []io.ReaderAt, sizes []int64) *MultiReaderAt

func (*MultiReaderAt) ReadAt

func (m *MultiReaderAt) ReadAt(p []byte, off int64) (totalN int, err error)

type ReaderAtCloserSize

type ReaderAtCloserSize interface {
	io.ReaderAt
	io.Closer
	Size() int64
}

func NewRemoteHTTPFileAsIoReaderAt

func NewRemoteHTTPFileAsIoReaderAt(ctx context.Context, url string) (ReaderAtCloserSize, int64, error)

NewRemoteHTTPFileAsIoReaderAt returns a ReaderAtCloser for a remote file. The returned ReaderAtCloser is backed by a http.Client.

type SplitCarFileReaderCreator

type SplitCarFileReaderCreator func(carFile carlet.CarFile) (ReaderAtCloserSize, error)

type SplitCarReader

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

func NewSplitCarReader

func NewSplitCarReader(
	files *carlet.CarPiecesAndMetadata,
	readerCreator SplitCarFileReaderCreator,
) (*SplitCarReader, error)

func (*SplitCarReader) Close

func (scr *SplitCarReader) Close() error

func (*SplitCarReader) ReadAt

func (scr *SplitCarReader) ReadAt(p []byte, off int64) (n int, err error)

Jump to

Keyboard shortcuts

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