Repository navigation
Conversation
Extract object-store construction out of `ColdTier::create_store` into a new `sequins-object-store` crate so other subsystems can open their own bucket or prefix without depending on the cold tier — which pulls in Vortex, DataFusion, and arrow. The new crate depends only on `object_store`, `serde`, `url`, and `thiserror`. `ObjectStoreConfig` moves there and is re-exported from `sequins-cold-tier` so the existing public path still resolves. Store-construction errors flatten onto the cold tier's existing `Config`/`Storage` variants, so error messages callers match on are unchanged. `create_store` now delegates; behaviour is identical. Adds `supports_conditional_put(uri)` for callers whose correctness rests on compare-and-swap. Verified against object_store 0.13.2 rather than assumed: - S3 (`If-Match` on the ETag), GCS (`x-goog-if-generation-match`), and Azure all support `PutMode::Update`. - `LocalFileSystem` does NOT — it returns `Error::NotImplemented`, though it does support `PutMode::Create`. A subsystem needing CAS must therefore reject a `file://` URI at configuration time. Callers must carry both `e_tag` and `version` into `UpdateVersion`: S3 matches on the ETag while GCS requires `version` and fails with `MissingVersion`. Tests: unit coverage for URI parsing, scheme rejection, directory creation, and the local Create-yes/Update-no behaviour; an env-gated integration test exercising Create conflict, stale-ETag rejection, successful CAS, and superseded-version replay rejection. Run green against MinIO via `SEQUINS_TEST_S3_URI`; not yet run against AWS S3. Also drops the now-unused `url` dependency from `sequins-cold-tier`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Requiring `PutMode::Update` for compare-and-swap would have forced every local
deployment onto MinIO, since `LocalFileSystem` returns `NotImplemented` for it.
That is not an acceptable constraint: `file://` must stay a first-class backend.
`PutMode::Create` is atomic on every backend — `LocalFileSystem` implements it
with `link(2)` — so linearizable state transitions should be built on it
instead. Rather than mutating one pointer object under an ETag CAS, write an
immutable `.../{next_generation}` key with `Create`: exactly one writer wins and
the losers get `AlreadyExists` and retry. One code path, identical behaviour on
a laptop and in production. The cost is a probe on the read path instead of a
single pointer read, which is irrelevant locally and cheap remotely.
Replaces `supports_conditional_put(uri) -> bool` — which invited callers to
reject a store — with `conditional_write_support(uri) -> ConditionalWriteSupport
{ create, update }`, which invites them to pick a strategy. `create` is true
everywhere; `update` is false only for local, and is now positioned as an
optimisation nothing may depend on.
Evidence, not assumption: a 32-way concurrent race on the local backend and a
16-way race against MinIO both confirm exactly one winner, every loser seeing
`AlreadyExists`, and the winner's bytes being the ones that persist.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tion Corrects the guidance from the previous commit. Unifying everything onto `PutMode::Create` traded a real cost in production — a mutable pointer becomes a probe forward instead of a single read — to avoid a second code path. That is the wrong trade for a read-heavy service. Deployments that have `PutMode::Update` should use it: one conditional write advances the pointer, one read returns it. Callers needing a mutable pointer supply their own serialisation only for `file://`, where single-node, low-traffic use makes the weaker guarantee acceptable. `file://` has to keep working; it does not have to be fast or multi-writer safe. No API or behaviour change — `conditional_write_support` already reports exactly what a caller needs to choose. This is documentation and test framing only. Also clarifies that the Create/Update split concerns mutable pointers alone: immutable content-addressed writes use `Create` on every backend, which is what the concurrent-race tests actually cover. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Implements SEQ-5 — first item on the critical path for the Git Forge & S3 Repository Engine project.
What changed
ColdTier::create_storewas a private method holding all object-store construction (local/S3/GCS/Azure). The forge needs the same logic for its own bucket, but depending onsequins-cold-tierwould drag in Vortex, DataFusion, and arrow just to open a store.New
sequins-object-storecrate —object_store,serde,url,thiserrorand nothing else:build(uri, &ObjectStoreConfig) -> Arc<dyn ObjectStore>ObjectStoreConfigmoves here, re-exported fromsequins-cold-tiersosequins_cold_tier::ObjectStoreConfigstill resolvesconditional_write_support(uri) -> ConditionalWriteSupport { create, update }create_storedelegates. Store-construction errors flatten onto the cold tier's existingConfig/Storagevariants, so messages callers match on are unchanged. Also drops the now-unusedurldep fromsequins-cold-tier.Conditional write capability
Checked against
object_store0.13.2 rather than trusting the docs:PutMode::CreatePutMode::UpdateIf-Matchon ETagx-goog-if-generation-matchlink(2)Error::NotImplementedThe split matters only for mutable pointers. Immutable content-addressed writes use
Createon every backend and need no fallback.For a mutable pointer,
Updateis the correct mechanism and is what production runs: one conditional write advances it, one read returns it.conditional_write_supportexists so a caller can select an implementation — never to reject a store. Whereupdateis false, the caller supplies its own serialisation forfile://and accepts weaker concurrency guarantees on a single-node, low-traffic backend where that is fine.file://has to keep working; it does not have to be fast or multi-writer safe.When using
Update, carry bothe_tagandversionintoUpdateVersion: S3 matches the ETag, GCS requiresversionand fails withMissingVersionwithout it.Tests
Unit (6): URI/bucket parsing, unsupported-scheme rejection,
file://directory creation, the localUpdategap (pinned so it fails loudly ifobject_storeever implements it), and a 32-way concurrent create race asserting exactly one winner, every loser seeingAlreadyExists, and the winner's bytes persisting.Integration (2,
tests/conditional_put_s3.rs, skipped unlessSEQUINS_TEST_S3_URIis set): ETag CAS round trip including stale-version rejection and superseded-version replay rejection, plus a 16-way create race mirroring the local one.Integration suite run green against MinIO in Docker (setup is in the test file's module docs). Not run against real AWS S3 — no credentials here, so that's worth one manual pass before relying on it in production.
🤖 Generated with Claude Code