Skip to content

Commit c17b575

Browse files
theronickennyjwilli
authored andcommitted
cast datomic.db.Db results from peer/transact to LocalDb. before returning (#1)
1 parent 9ea69d1 commit c17b575

File tree

1 file changed

+6
-2
lines changed
  • src/compute/datomic_client_memdb

1 file changed

+6
-2
lines changed

src/compute/datomic_client_memdb/core.clj

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
(defonce clients (atom {}))
99

10+
(defn update-vals [m ks f]
11+
(reduce #(update-in % [%2] f) m ks))
12+
1013
(defn- throw-unsupported
1114
[data]
1215
(throw (ex-info "Unsupported operation." data)))
@@ -61,7 +64,8 @@
6164
(LocalDb. (peer/db conn) db-name))
6265

6366
(transact [_ arg-map]
64-
@(peer/transact conn (:tx-data arg-map)))
67+
(-> @(peer/transact conn (:tx-data arg-map))
68+
(update-vals #{:db-before :db-after} #(LocalDb. % db-name))))
6569

6670
(tx-range [_ arg-map]
6771
(peer/tx-range (peer/log conn) (:start arg-map) (:end arg-map)))
@@ -116,4 +120,4 @@
116120
(let [new-client (map->Client {:db-lookup (atom {})
117121
:client-arg-map arg-map})]
118122
(swap! clients assoc arg-map new-client)
119-
new-client)))
123+
new-client)))

0 commit comments

Comments
 (0)