feat(storage): add Route 53 backend (TXT records, base64-encoded items, the works)#54
Open
quinnypig wants to merge 1 commit into
Open
feat(storage): add Route 53 backend (TXT records, base64-encoded items, the works)#54quinnypig wants to merge 1 commit into
quinnypig 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 |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.