A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
download.h File Reference

Downloading a URL to a verified file in a local cache. More...

#include <filesystem>
#include <string>
#include <absl/status/statusor.h>
#include "a11/concurrency/future.h"
#include "a11/net/http/fetch.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::net::DownloadOptions
 Where a download goes, and what proves it arrived intact. More...
 

Namespaces

namespace  a11
 
namespace  a11::net
 

Functions

absl::StatusOr< std::string > a11::net::FileSha1 (const std::filesystem::path &path)
 Computes the SHA-1 of a file, as lowercase hex.
 
a11::Future< std::filesystem::path > a11::net::Download (std::string url, DownloadOptions options)
 Downloads url to options.destination, verified and atomically.
 

Detailed Description

Downloading a URL to a verified file in a local cache.

The shape every model-fetching caller needs: a file that is either absent or complete and correct, never half-written, and cheap to ask for again. A download streams to a temporary sibling, hashes as it goes, and is renamed into place only once the digest matches – so a crash, a full disk, or two processes racing for the same model leaves the cache usable rather than poisoned.