feat(storage): add Route 53 backend (TXT records, base64-encoded items, the works)#54
feat(storage): add Route 53 backend (TXT records, base64-encoded items, the works)#54quinnypig wants to merge 1 commit into
Conversation
Adds extenddb-storage-route53 as a storage backend behind a "route53" cargo feature. Items are encoded as TXT records under a configured hosted zone, with partition keys mapping to subdomain labels. The JSON item body is base64-encoded and chunked across the 255-byte strings of a TXT resource record. Encoding module is implemented and round-trip tested (cargo test -p extenddb-storage-route53). The Bootstrapper trait is registered. Every method returns an Internal error annotated with the Route 53 API call a real implementation would issue (CreateHostedZone, ChangeResourceRecordSets, ListResourceRecordSets, DeleteHostedZone, GetChange). Not enabled by default. Closes the gap between the pluggable-backend trait and the number of backends a v0.1.0 binary recognizes. Personal history with the premise predates the repository; see PR description.
|
We really need a postgres plugin for this too |
|
|
I vote for merge, because this has legitimate engineering merit when combined with other services such as ec2 or even AWS Lambda. If an AWS service has Internet access, it has DNS access, which makes DNS a viable bootstrap and minimal state containment mechanism. You could encode and encrypt an initialization sequence, distribute it through this service via DNS, and use it to provide the minimal state transition data needed for a web service to initialize. At that point, a cluster of Lambda functions could bootstrap configuration from DNS and coordinate finite state machine transitions through serialized DNS updates consumed by the rest of the cluster. Done. So beyond being funny, I think this is actually technically useful. |
|
Grab the code from here and merge: https://github.com/ongres/dyna53, it's already done. (oh, well, different language, but easy to translate) |
Forward
I have been arguing in public that Route 53 is a database since 2020. There is a blog post. There are charity shirts. Strangers send me screenshots of YAML files that use TXT records as feature flags. The bit predates this repository's first commit by a comfortable margin.
ExtendDB shipped at v0.1.0 with a pluggable-backend trait, exactly one backend implementation, and a
--backendflag that lists Cassandra without irony. I cannot, in good conscience, walk past that.This PR adds a Route 53 storage backend.
What's in here
A new
extenddb-storage-route53crate behind aroute53cargo feature. Items are encoded as TXT records under a configured hosted zone. Partition keys become subdomain labels. The JSON-serialized item body is base64-encoded and split across the 255-byte strings of a single TXT resource record, with overflow spilling into sibling records keyed by sequence number.The encoding module (
crates/storage-route53/src/encoding.rs) is real Rust with round-trip tests.cargo test -p extenddb-storage-route53passes.The
Bootstrappertrait is registered. Every method returnsOpError::Internalannotated with the Route 53 API call a real implementation would issue:CreateHostedZone,ChangeResourceRecordSets,ListResourceRecordSets,DeleteHostedZone,GetChange. A future implementer has a clear porting map.Why this is not as deranged as it sounds
Route 53 has properties that, taken in the right order, make the substrate look reasonable:
ChangeResourceRecordSetsreturnsPENDINGand thenINSYNConce the change is on every authoritative nameserver. That is a stronger durability story than DynamoDB's documented "strongly consistent reads" contract, which says nothing about multi-region propagation.ttl_deletion_target_secondssetting maps directly onto it. Items vanish from caching resolvers within the TTL without a background sweeper.ConsistentRead=falsebecomes "resolve via any caching DNS resolver." For workloads with a high cache-hit rate, the per-read cost approaches zero. That describes a depressingly large fraction of production DynamoDB tables.Route 53 also has properties that, in any other order, make the substrate look indefensible:
ChangeResourceRecordSetsis rate-limited to five per second per region per AWS account. That is the effective write capacity unit. The batch endpoint amortizes this somewhat.I am genuinely unsure which list is more interesting. I have included both for the reviewer's enjoyment.
Pricing
ChangeResourceRecordSetscallFor read-heavy workloads with high temporal locality this is the rare AWS configuration where unit economics improve with scale rather than punishing it. For write-heavy workloads it is a downgrade. Choosing between the two is left to operations teams who have read this PR and found themselves nodding for reasons they cannot articulate.
Streams
Route 53 exposes a
GetChangeAPI that returns the propagation state of a pending change. The streams implementation pollsGetChangefor each outstanding change ID and emits a stream record when the change flips toINSYNC.ApproximateCreationDateTimemaps toSubmittedAt. Shard iteration becomes "list pending changes for this zone in submission order." The mapping is left to the reviewer.Build matrix
cargo buildroute53not registered.cargo build --features route53extenddb init --backend route53reaches the bootstrapper and returns the Route-53-flavored error from the first method called.cargo test -p extenddb-storage-route53Before / after
Before:
After (built with
--features route53):The user now has both an error and a porting map to the AWS API call a real implementation would invoke.
What's still missing
Bootstrapperimpl (registered, stubbed with sourced errors)encodingmodule (chunking, base64, round-trip tests)OperationsEngineRegistrationStorageConfigRegistrationSettingsStoreRegistrationDiagnosticsStoreRegistrationServerComponentsRegistrationcrates/bin/src/config.rs(hard-references postgres)Organizational note
If accepted, this would make ExtendDB the first AWS-managed open-source project whose storage layer is also a covered AWS service. I do not have a strong opinion on whether that is good or bad. I do think it is worth flagging out loud before merge, rather than after.
If the preferred resolution is to remove the implicit invitation in the
--backendhelp text instead, I will withdraw this PR and submit a one-line edit tocrates/bin/src/cmd_init.rs:19. Both resolve the same contradiction. The choice of which is funnier is yours.I do declare that Route 53 is in fact a database. I dare you to prove me wrong.