Skip to main content

How To Read This Matrix

Watching has two independent halves:
  • Delivery (ws.watch() and ws.notify()) works on every mount. Mirage invalidates caches, matches scopes, and delivers the event stream.
  • Detection is backend-specific. Pull marks resources whose deltaHook() ships with Mirage. Push signal names the provider mechanism that your application can map to a FileEvent.

Delivery Without a Hook

Any backend becomes watchable as soon as your application has a signal:
watch() returns an async generator, so it subscribes on the first iteration, not at the call: the loop above and the notify call belong to different tasks (a request handler, a poll loop). Awaiting notify before anything consumes the iterator drops the event. The guarantee is the same on every backend: caches for the changed path and its ancestor listings are invalidated before delivery.

Adding Pull Detection

ListingDeltaHook provides a generic checkpointed diff. A backend supplies an async walk that reads the backend directly and yields stable fingerprints:
Backends with a native cursor API can implement pull(root, checkpoint) directly. The opaque checkpoint can be a Dropbox cursor, a Microsoft Graph delta link, or any other serialized provider state.