Learn by example
14. External blob storage
BlobRepository coordinates an in-memory entity catalog with an object bucket as one mutation boundary, so the
chapter can show the write ordering without a database. Fields can be required, eagerly loaded, dual-written, prefixed, or encrypted per tenant.
let mut repository = BlobRepository::new(bucket, [
BlobFieldConfig::new("body").required().load_on_scan(),
BlobFieldConfig::new("attachment").codec(TenantAes256Gcm::new(master_seed)),
]);The example creates and reads an encrypted tenant attachment, proves another tenant cannot decrypt it, then deletes the row and verifies orphaned objects are removed.
The minimal entity-side declaration is
crates/rent/examples/tutorial_13_external_blobs/schema.rsl.
Run cargo run -p rent --example tutorial_13_external_blobs. The same storage workflow runs under nextest.