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

Public Types

enum  Error {
  NotFound , Forbidden , Misc , Transient ,
  Interrupted
}

Public Member Functions

virtual void upload (const std::string &uri, std::string data, const Headers &headers={})=0
virtual bool exists (const std::string &uri, const Headers &headers={})=0
virtual std::pair< FileTransferResult, box_ptr< Source > > download (const std::string &uri, const Headers &headers={})=0

Member Function Documentation

◆ download()

virtual std::pair< FileTransferResult, box_ptr< Source > > nix::FileTransfer::download ( const std::string & uri,
const Headers & headers = {} )
pure virtual

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).

Implemented in nix::curlFileTransfer.

◆ exists()

virtual bool nix::FileTransfer::exists ( const std::string & uri,
const Headers & headers = {} )
pure virtual

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.

Implemented in nix::curlFileTransfer.

◆ upload()

virtual void nix::FileTransfer::upload ( const std::string & uri,
std::string data,
const Headers & headers = {} )
pure virtual

Upload some data. May throw a FileTransferError exception.

Implemented in nix::curlFileTransfer.


The documentation for this struct was generated from the following file: