Expand description
The BRPROJ project export/import bundle format (tar + JSON MANIFEST + per-member
SHA-256). Dependency-light + testable in every build; the driver that fills it is
feature-gated.
The BRPROJ project export/import bundle — the on-disk format a
project export writes and a project import reads.
A bundle is a plain tar whose FIRST entry is a JSON MANIFEST describing every
other member, followed by the per-engine payloads:
MANIFEST magic "BRPROJ" | format_version | created_at | data_only | members[]
kv.brkvdump the control-plane KV logical slice (kv_dump::export_to_bytes bytes)
sql/<db>.pgc a streamed Postgres dump (pg_dump custom/plain)
libsql/<project>/<site>/<db>.sqlite a VACUUM INTO snapshot of a libsql database
blobs/<...> blob-store objectsDiscipline borrowed from boatramp_core::kv_dump: a loud magic (BRPROJ) and
an explicit format version the reader refuses if unknown (never misreads a
foreign/newer file), plus a per-member SHA-256 checksum the reader VERIFIES on
extraction (byte-integrity, not a size check) — so a truncated/corrupt bundle is
caught before a single row is restored.
The writer takes members already staged on disk (the multi-GB pg_dump stream
lands in a staging file via run_ephemeral’s streaming sink, the libsql VACUUM INTO writes a file, the KV slice + blobs are staged too), so each member is appended
with a known size — correctness over the PAX unknown-length streaming form, and the
staging keeps memory bounded regardless of dump size. All IO is synchronous (the
tar crate is sync); the async driver calls it from a blocking task.
Structs§
- Manifest
- The bundle MANIFEST — the first tar entry, describing the whole bundle.
- Manifest
Member - One member described in the MANIFEST.
- PgMember
Info - SQL-dump provenance for a
PgDump/MysqlDumpmember: the detected server version, the client image used to produce (and required to restore) it, and the schema-ledger fingerprint for the import schema-skew check. (Field namedpghistorically; it carries MySQL provenance too — the engine is the member’sMemberKind.) - Source
Info - What the bundle was exported from.
- Staged
Member - A member staged on disk, ready to be appended to a bundle.
Enums§
- Bundle
Error - A project-bundle error.
- Member
Kind - Which engine a bundle member came from.
Constants§
- BUNDLE_
FORMAT_ VERSION - The bundle FORMAT version. Bumped only on an incompatible change; a reader refuses an unknown version rather than misreading it.
- BUNDLE_
MAGIC - The bundle magic — carried in the MANIFEST so a stray/foreign tar is rejected loud.
- IDENTITY_
MEMBER_ PATH - The identity transport-container’s tar-entry path (
--include-identityonly): the passphrase-wrapped KEK, produced byboatramp_server::envelope::transport_wrap. - KV_
MEMBER_ PATH - The control-plane KV slice’s tar-entry path (the
kv_dump::export_to_bytesbytes). - MANIFEST_
PATH - The manifest’s tar-entry path — MUST be the first entry in the bundle.
Functions§
- extract_
and_ verify - Extract every member of
bundleintoout_dir, VERIFYING each member’s SHA-256 against the MANIFEST as it streams (byte-integrity). Refuses a member the manifest does not describe, and a manifest member the bundle does not contain. Returns the validated MANIFEST. Member files land atout_dir/<member.path>. - read_
manifest - Read + validate the MANIFEST (the first tar entry) from
bundle, without extracting any member. - write_
bundle - Write a bundle at
outfrom members already staged on disk: compute each member’s size + SHA-256, build + validate the MANIFEST, then write the tar with the MANIFEST first and every member streamed from its staging file (bounded memory). Returns the MANIFEST that was written.