Expand description
SQLite-backed Public Info Base (PIB), wire-compatible with
ndn-cxx’s pib-sqlite3 backend.
§Compatibility
An ndn-rs binary using SqlitePib should be able to open a pib.db
created by ndnsec (the ndn-cxx CLI) and operate on it without
corruption, and vice versa. To make that work, this module replicates
the ndn-cxx schema bit-for-bit — same tables, same indexes, same
triggers, same column types, same wireEncode()-based name storage.
Diverging from the schema in any way (adding PRAGMA user_version,
storing names as URI strings, omitting a trigger, …) would silently
make the resulting database incompatible.
Pinned to ndn-cxx tag ndn-cxx-0.9.0, commit
0751bba88021b745c1a0ab7198efd279756c9a3c, file
ndn-cxx/security/pib/impl/pib-sqlite3.cpp lines 33–186 (DB_INIT).
§Storage conventions (MUST match ndn-cxx)
- Default DB path:
$HOME/.ndn/pib.db(withTEST_HOMEand CWD fallbacks; seeSqlitePib::open_default). - All
Namecolumns hold the TLV wire encoding of the Name (outer type0x07+ length + components), not URI strings. - The
key_bitscolumn holds raw public-key bytes — for ndn-cxx-issued keys, this is a DER-encodedSubjectPublicKeyInfo. - The
certificate_datacolumn holds the full Data-packet wire encoding of the certificate. tpm_locatoris stored as a UTF-8 string in aBLOBcolumn.PRAGMA foreign_keys=ONis set at every connection open. Without it theON DELETE CASCADErules become no-ops, leaking orphan rows thatndnsecwill then trip over.- Default-row invariants are maintained by triggers, not by Rust
code.
add_*calls justINSERTand let the triggers do the rest. Mutating a row’sis_defaultis also delegated.
Structs§
- Sqlite
Pib - SQLite-backed PIB, wire-compatible with ndn-cxx
pib-sqlite3.