Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::curlFileTransfer Struct Reference
Inheritance diagram for nix::curlFileTransfer:
nix::FileTransfer

Classes

struct  TransferItem
struct  State
struct  TransferSource

Public Member Functions

void unpause (const std::shared_ptr< TransferItem > &transfer)
void cancel (const std::shared_ptr< TransferItem > &transfer)
 curlFileTransfer (unsigned int baseRetryTimeMs)
void wakeup ()
void stopWorkerThread ()
void workerThreadMain ()
void workerThreadEntry ()
void enqueueItem (std::shared_ptr< TransferItem > item)
void upload (const std::string &uri, std::string data, const Headers &headers) override
std::optional< std::pair< FileTransferResult, box_ptr< Source > > > tryEagerTransfers (const std::string &uri, const Headers &headers, const std::optional< std::string > &data, bool noBody)
std::pair< FileTransferResult, box_ptr< Source > > enqueueFileTransfer (const std::string &uri, const Headers &headers, std::optional< std::string > data, bool noBody)
bool exists (const std::string &uri, const Headers &headers) override
std::pair< FileTransferResult, box_ptr< Source > > download (const std::string &uri, const Headers &headers) override

Public Attributes

std::unique_ptr< CURLM, decltype([](auto *m) { curl_multi_cleanup(m);})> curlm
const unsigned int baseRetryTimeMs
Sync< Statestate_
std::thread workerThread

Additional Inherited Members

Public Types inherited from nix::FileTransfer
enum  Error {
  NotFound , Forbidden , Misc , Transient ,
  Interrupted
}

Member Function Documentation

◆ download()

std::pair< FileTransferResult, box_ptr< Source > > nix::curlFileTransfer::download ( const std::string & uri,
const Headers & headers )
inlineoverridevirtual

Download a file, returning its contents through a source. Will not return before the transfer has fully started, ensuring that any errors thrown by the setup phase (e.g. HTTP 404 or similar errors) are not postponed to be thrown by the returned source. The source will only throw errors detected during the transfer itself (decompression errors, connection drops, etc).

Implements nix::FileTransfer.

◆ exists()

bool nix::curlFileTransfer::exists ( const std::string & uri,
const Headers & headers )
inlineoverridevirtual

Checks whether the given URI exists. For historical reasons this function treats HTTP 403 responses like HTTP 404 responses and returns false for both. This was originally done to handle unlistable S3 buckets, which may return 403 (not 404) if the reuqested object doesn't exist in the bucket.

Bugs

S3 objects are downloaded completely to answer this request.

Implements nix::FileTransfer.

◆ upload()

void nix::curlFileTransfer::upload ( const std::string & uri,
std::string data,
const Headers & headers )
inlineoverridevirtual

Upload some data. May throw a FileTransferError exception.

Implements nix::FileTransfer.


The documentation for this struct was generated from the following file:
  • lix/libstore/filetransfer.cc