namespace rgpot::aoti_unpack

Overview

namespace aoti_unpack {
 
// namespaces
 
namespace rgpot::aoti_unpack::detail;
 
// structs
 
struct CacheRoot;
struct Unpacked;
struct ZipEntry;
 
// classes
 
class ZipReader;
 
// global variables
 
const char* kCacheDirEnv = “RGPOT_CACHE_DIR”;
const char* kRunDirCache = “.rgpot-cache”;
const char* kManifest = “rgpot-unpack.manifest”;
const char* kManifestMagic = “rgpot-aoti-unpack 1”;
std::chrono::hours kLeftoverAge {1};
 
// global functions
 
std::string sha256_file(const fs::path& path);
CacheRoot resolve_cache_root(const std::string& configured);
Unpacked unpack(const fs::path& package, const fs::path& root, const std::string& model = “model”);
std::unordered_map<std::string, std::string> parse_flat_json(const std::string& text);
std::unordered_map<std::string, std::string> read_metadata(const fs::path& path);
 
} // namespace aoti_unpack

Detailed Documentation

Global Variables

const char* kCacheDirEnv = “RGPOT_CACHE_DIR”

Environment variable naming the cache root when the config has none.

const char* kRunDirCache = “.rgpot-cache”

Cache root below the run directory when nothing else names one.

const char* kManifest = “rgpot-unpack.manifest”

Written last into an unpack; a directory without it is not an unpack.

std::chrono::hours kLeftoverAge {1}

Leftover build or stale directories older than this are removed.

Global Functions

CacheRoot resolve_cache_root(const std::string& configured)

The cache root, in order: the explicit config value, $RGPOT_CACHE_DIR, $XDG_CACHE_HOME/rgpot (absolute values only, as the XDG base directory specification requires), then .rgpot-cache in the working directory. The result is absolute, so a later chdir does not move it.

Unpacked unpack(const fs::path& package, const fs::path& root, const std::string& model = “model”)

Unpack package under root and return the unpacked paths. A valid earlier unpack of the same bytes is reused; no file is ever written outside root.

std::unordered_map<std::string, std::string> parse_flat_json(const std::string& text)

Parse the flat JSON object torch writes as <model>_metadata.json. String values are unescaped; any other scalar is kept as its literal text.