HTTP Format

DataAxesFormats.HttpFormat Module

Read-only access to a FilesDaf directory served over HTTP.

The server is assumed to expose the FilesDaf directory tree verbatim, with GET {url}/{relative_path} returning the byte contents of the file. Any static web server (e.g. python -m http.server , nginx , S3 with HTTP access) pointed at the root directory will do.

The client downloads metadata.json once at open time and keeps the parsed dict in memory for the lifetime of the HttpDaf . Every per-property descriptor (axes, scalars, vectors, matrices) is served from this in-memory dict, so enumerating scalars/axes/vectors/matrices and reading all their JSON metadata completes without further HTTP traffic.

Non-JSON payloads (axis entry .txt files, per-property .data / .nzind / .nzval / .colptr / .rowval / .nztxt ) are fetched lazily on first use via one GET each. Dense and sparse numeric vectors/matrices are returned zero-copy by unsafe_wrap 'ing the downloaded Vector{UInt8} buffer; the buffer is held alive by the same cache entry that holds the returned array. The server data is assumed stable while an HttpDaf is open; reopening is the only way to pick up server-side changes.

Packed (chunked + compressed) properties are served as one <name>.zip shard per property (or <name>.<component>.zip per packed sparse component). Rather than downloading the whole shard, HttpDaf issues a suffix-Range GET to read the shard's ZIP central directory once, then a Range GET per needed chunk (adjacent chunk ranges are coalesced into a single request), decoding and caching each chunk on demand. The shard layout and codec catalogue are documented in PackedFormat .

Warning

Because returned vectors/matrices alias the cache entry's Vector{UInt8} backing, calling empty_cache! releases the memory that those arrays read from. Any vector/matrix reference previously returned by this format becomes dangling after the cache is emptied. Only call empty_cache! once you have dropped all references returned by prior queries.

Only a read-only interface is exposed; mutations are not supported.

DataAxesFormats.HttpFormat.HttpDaf Type
struct HttpDaf <: DafReader ... end

HttpDaf(
    url::AbstractString;
    [name::Maybe{AbstractString} = nothing,
    packed::Bool = false]
)::HttpDaf

Open a read-only view of a remote FilesDaf served over http:// or https:// . url points at the root directory; the server must expose metadata.json and daf.json alongside the usual FilesDaf tree.

If name is not specified and the remote data set defines a name scalar property, it is used as the name; otherwise, the url itself is used.

The packed kwarg is accepted for API uniformity with the writable formats but has no effect — HttpDaf is read-only, and packed controls only the per-daf write default.

Warning

Vectors and matrices returned by this format alias Vector{UInt8} buffers that are held alive by the Daf cache. Calling empty_cache! on this HttpDaf releases those buffers, so any previously returned array reference becomes dangling. Drop all such references before emptying the cache.

Note

ZipDaf archives intentionally do not contain metadata.json , so an unzip foo.daf.zip -d foo.daf/ produces a directory that lacks it. Before exposing such a directory over HTTP, open it once locally with FilesDaf("foo.daf") (any mode) so FilesFormat.ensure_metadata_json! builds it.

Index