Usage without schema
Usage with schema
API
| Method | Description |
|---|---|
set(value: T) | Write a new value |
value() | Returns current value or null if not set |
meta() | Returns { updatedAtMs: number; author: number } | null — timestamp and author of the winning write |
onChange(fn) | Subscribe — returns unsubscribe function |
stream() | Returns an Effect Stream<T | null> that emits on every change |
Conflict resolution
Conflicts are resolved by HLC timestamp (wall clock + logical counter). The write with the highest timestamp wins. If timestamps are equal, the write from the highestclient_id wins. This is deterministic and consistent across all replicas.