Files
atomsync/src/pocketbook/store.cljc
Florian Schroedl 973b079ae3 refactor: replace core.async with promesa for all async operations
- Store protocol now returns promesa promises instead of core.async channels
- MemoryStore: `(p/resolved val)` replaces chan+put!+close! ceremony
- IDBStore: `p/create` with resolve/reject wraps IDB callbacks
- sync.cljc: CLJ uses `p/vthread`, CLJS returns native Promise chains
- core.cljc: `p/let` replaces go blocks, timer-based sync loop replaces
  go-loop+alts!, debounced push replaces kick channel
- Tests use `deref` with timeout on promesa promises
- Todomvc example uses `p/let` instead of go/<!
2026-04-16 20:05:08 +02:00

24 lines
775 B
Clojure

(ns pocketbook.store
"Storage protocol for Pocketbook.
All methods return promesa promises.")
(defprotocol PStore
(put-doc! [store doc]
"Write a document to the store. doc is a map:
{:id str, :value any, :version int, :updated int, :deleted bool, :synced bool}
Returns a promise that resolves on success.")
(docs-by-prefix [store prefix]
"Get all documents whose id starts with prefix.
Returns a promise yielding a vector of doc maps.")
(get-meta [store key]
"Get a metadata value by key.
Returns a promise yielding the value, or nil if not found.")
(set-meta! [store key value]
"Set a metadata value. Returns a promise that resolves on success.")
(close-store! [store]
"Close the store and release resources."))