If somebody is interested, Datahike cljs works in memory now (WIP), you can find it in this branch https://github.com/replikativ/datahike/tree/cljs-lean-cps. If we had a konserve store that holds all values in memory to read (including loading all of them at init), but writes through into an underlying durable store, then this would already work as a durable database, since our transact/writing pipeline is already fully async. One could do this with a memory->indexeddb->remote backend store (e.g. S3/sql) hierarchy for instance.
You might have to point the deps entries for the persistent sorted set back to git.
Here is the sandbox I played around with:
(ns sandbox
(:require
[datahike.api :as d]
[clojure.core.async :refer [<! >! chan put! close!]])
(:require-macros [clojure.core.async :refer [go]]))
(def schema [{:db/ident :name
:db/cardinality :db.cardinality/one
:db/index true
:db/unique :db.unique/identity
:db/valueType :db.type/string}
{:db/ident :sibling
:db/cardinality :db.cardinality/many
:db/valueType :db.type/ref}
{:db/ident :age
:db/cardinality :db.cardinality/one
:db/valueType :db.type/long}])
(def cfg {:store {:backend :mem :id "sandbox"}
:keep-history? true
:schema-flexibility :write
:attribute-refs? false})
(go
(def cfg (<! (d/create-database cfg))))
(def conn (d/connect cfg))
(go
(def tx-report (<! (d/transact! conn schema))))
(go
(def tx-report2 (<! (d/transact! conn [{:name "Petersjj"
:age 42}]))))
;; c.historical is not a function
(d/q '[:find ?e ?v :where [?e :name ?v]] @conn)
(into {} (d/entity @conn 4))
(d/pull @conn '[:db/id :name] 4)
(d/as-of @conn (js/Date.))
(d/history @conn)
(d/datoms @conn :eavt)you're thinking about browser-use-cases here?
Most definitely.
If it works in JS you could deploy at the edge with clouldflare and then have a central server for linear writes
@pat and I are working on making the index data structure and query engine async with https://github.com/simm-is/partial-cps