Expand description
Op-layer for the chunkedTrustTask backup transfer algorithm.
The stream algorithm moves a bundle over the VTA’s HTTPS blob endpoint,
which a VTA reachable only over DIDComm or TSP does not have. This one moves
it as a sequence of Trust Tasks over whatever transport carries the control
plane: vta/backup/get-chunk/1.0 pulls an export chunk by index, and
vta/backup/put-chunk/1.0 writes an import chunk checked against a manifest
the operator committed before any chunk moved. The normative account is
vta/backup/initiate-export/1.1 § Chunked transfer
(trustoverip/dtgwg-trust-tasks-tf#474).
It reuses the descriptor pattern’s BundleRecord state machine and staging
directory unchanged, and keeps what is new — the manifest and which indices
have moved — in a ChunkPlan beside the record, under its own key prefix,
so the record’s shape (and every reader of it) is untouched.
Four properties the specification makes normative, and where each is held:
- Pulled, not pushed. Nothing here sends; every chunk is an answer to a request, so a chunk lost in transit is one the client knows it lacks.
- Non-consuming reads.
get_chunkserves by offset from the staged file and never deletes it; the bundle goes oncomplete-export,abortor expiry. - Idempotent writes.
put_chunkchecks every chunk against the pre-committed digest, so the only bytes an index can ever hold are the committed ones; a repeat isstored: false. - Bounded expiry. Activity slides
expires_atforward, never past a ceiling fixed when the bundle was minted.
Structs§
- Chunk
Plan - The manifest and progress of one chunked bundle, stored at
chunks:{bundle_id}in the bundles keyspace beside itsBundleRecord. - Chunk
Rate Limiter - Token bucket per authenticated DID for chunk requests.
- Chunk
Write - One
put-chunkrequest, as the op reads it. - Chunked
Bundle - What a chunked
initiate-exporthands back: the manifest and the terms. - PutOutcome
- What one accepted write reports back.
- Served
Chunk - One served chunk.
Enums§
- Chunked
Error - Why a chunked operation refused. Kept apart from
AppErrorbecause most arms are a specification error code the handler must put on the wire as<task-slug>:<code>, and several carry thedetailsthat code declares.
Constants§
- CHUNK_
REQUESTS_ PER_ SECOND - Chunk requests one DID may make per second, sustained.
- CHUNK_
REQUEST_ BURST - Burst above
CHUNK_REQUESTS_PER_SECONDa DID may spend at once. - MAX_
REPORTED_ MISSING - Largest
missingIndiceslist anincompleteUploadrefusal carries (vta/backup/finalize-import/1.1bounds it).
Functions§
- all_
served - Whether every chunk of a chunked export has been served at least once — the
meaning
complete-export’sdownloadedtakes for such a bundle.Nonefor a bundle with no chunk plan (astreambundle). - delete_
plan - Remove a bundle’s chunk plan. Called when the bundle ends and by the sweeper’s retention pass; absent is not an error.
- finalize_
precheck - The checks
finalize-importmust make of a chunked bundle before the password is used: every chunk present, and the assembled bytes equal to the committed whole-bundle digest and size. On success the bundle moves toImportReceived, which is the state the finalize op accepts. - get_
chunk - Serve chunk
indexof a chunked export bundle. - get_
plan - Fetch the chunk plan for a bundle, if it has one.
- initiate_
export - Mint a
chunkedTrustTaskexport bundle. - initiate_
import - Open a chunked import slot for a manifest the producer has pre-committed.
- put_
chunk - Write chunk
indexof a chunked import. - stage_
export - Stage already-encrypted export bytes as a chunked bundle. Split from
initiate_exportso the staging and serving logic can be exercised without a full agent to serialize.