Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
HttpTransport.ixx File Reference

One HTTP request, moved. More...

#include <cstddef>
#include <cstdint>
#include <functional>
#include <string>
#include <vector>

Classes

struct  Mila::Distribution::HttpFetch
struct  Mila::Distribution::HttpHeader
struct  Mila::Distribution::HttpResponse
class  Mila::Distribution::IHttpTransport
 Performs one HTTP GET. More...

Namespaces

namespace  Mila
 Mila main API namespace.

Typedefs

using Mila::Distribution::HeadersCallback
 Called once when the response line and headers have arrived, before any body.
using Mila::Distribution::SinkCallback
 Called with each chunk of body as it arrives.

Detailed Description

One HTTP request, moved.

No interpretation of the answer.

The narrow half of the split described in Specifications/HttpClient.md: a transport moves bytes for one request; HttpClient decides how to ask and how to read the reply. Nothing security-relevant is decided here, which is why a transport can be supplied by a host language without being trusted with a token.

Typedef Documentation

◆ HeadersCallback

Initial value:
std::function<void( long http_code, uint64_t content_length )>

Called once when the response line and headers have arrived, before any body.

Exists so a caller can report progress against a total it would otherwise only learn after the transfer finished.

◆ SinkCallback

Initial value:
std::function<bool( const char* data, size_t length )>

Called with each chunk of body as it arrives.

Return false to abort.

The transport neither buffers nor hashes; a caller writing a 6 GB artifact hashes and writes here so the bytes are touched exactly once.