@jem-open/mbali-firestore
v0.6.0
Published
mbali RunStore driver for Google Cloud Firestore. Bring your own Firestore client instance.
Readme
@jem-open/mbali-firestore
Firestore drivers for mbali: a durable RunStore and a durable IngressBuffer. Bring your
own Firestore client instance — this package carries no runtime dependency on the SDK.
import { Firestore } from "@google-cloud/firestore";
import { FirestoreRunStore, FirestoreIngressBuffer, type FirestoreLike } from "@jem-open/mbali-firestore";
const db = new Firestore({ projectId }) as unknown as FirestoreLike;
const runStore = new FirestoreRunStore({ firestore: db });
const buffer = new FirestoreIngressBuffer({ firestore: db });Required composite index
The reconcile forward sweep queries planeId == … AND status == … AND startedAt < …, which
Firestore serves only with a composite index. Ship the included
firestore.indexes.json:
firebase deploy --only firestore:indexes # if using the Firebase CLI
# or create it from the console URL that a missing-index error printsFirestoreRunStore.query() rethrows a missing-index error with a clear message pointing
here, so the first reconcile tick fails loudly and actionably rather than silently aborting.
Leases
tryAcquireLease / releaseLease use a Firestore transaction for real atomic
compare-and-set — this is what makes the engine's exclusive locks and dispatch/event dedup
safe under concurrent ticks. Lease docs live in <collection>__leases.
