This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-12
Channels
- # babashka (22)
- # beginners (112)
- # calva (7)
- # cider (2)
- # clj-kondo (43)
- # cljdoc (25)
- # cljsrn (30)
- # clojars (16)
- # clojure (73)
- # clojure-australia (2)
- # clojure-bay-area (8)
- # clojure-europe (16)
- # clojure-finland (1)
- # clojure-italy (2)
- # clojure-nl (7)
- # clojure-uk (9)
- # clojurescript (28)
- # clojureverse-ops (2)
- # conjure (2)
- # css (22)
- # cursive (28)
- # datomic (9)
- # depstar (28)
- # emacs (6)
- # fulcro (39)
- # graalvm (61)
- # honeysql (38)
- # instaparse (3)
- # jobs (1)
- # kaocha (3)
- # malli (7)
- # pathom (83)
- # sql (3)
- # tools-deps (18)
- # vim (2)
- # xtdb (15)
btw, scylla is particularly of interest to me because of the recent cdc feature: https://docs.scylladb.com/using-scylla/cdc/cdc-intro/ I wonder if this could be leveraged to efficiently patch documents somehow, among other interesting things you could do (structured doc store instead of blobs?) the ease of operation is also nice of course
Thanks for the context, this is pretty interesting! A patch-structured document store backend would be most welcome ☺️
or even somehow inferring txs from the doc store rather than the application handling both with https://github.com/scylladb/scylla-cdc-java/tree/master/scylla-cdc-kafka-connect
To reliably infer Crux transactions I think you either need to be able to derive from an existing log or record a new log - a CDC flow into Kafka would do the job :thumbsup: assuming that was the only source of transactions you could then use the (internal) transaction API to save having to write Crux transactions back out to a new Kafka log
I wonder if you could then have a single API that selectively pipes into crux, so you can separate your business-critical, bitemporally valuable stuff from high-volume application state changes
or even multiple crux nodes with e.g. different lucene indexing strategies, depending on the document structure
maybe multitenancy as well, so crux.tx/put {:client/id 1 ...} gets sent to the appropriate tx log transparently
That's kind of what I'm thinking of trying out. Just have separate topics for different kind of events and use them to build up crux. And only use the resulting crux for queries.
and in clojure we already have pathom for a unified query api that glues together different data sources
I think you'd have to be really careful if you needed temporal consistency across all of them though
may be more of a clojure question than a crux question, but what's with this behavior:
(put {:crux.db/id {:test/id 1} :ref 2}) (put {:crux.db/id {:test/id 2} :ref 3}) ;; this works, returning #{[3]} (q '{:find [?e] :where [[{:test/id 1} :ref ?x] [(array-map :test/id ?x) ?x2] [?x2 :ref ?e]]}) ;; this doesn't, returning emptyset (q '{:find [?e] :where [[{:test/id 1} :ref ?x] [(identity {:test/id ?x}) ?x2] [?x2 :ref ?e]]}) ;; this is true (= (identity {:a 1}) (array-map :a 1))
it's a Crux Datalog behaviour - you can't use Clojure collection literals as arguments to predicates (except set literals, which act as relations, not Clojure sets). So if you want to use a Clojure map as a predicate argument you have to feed it in via another clause that binds the output of array-map
to an intermediate logic variable...exactly like you've got in your first example 🙂
ah, thanks for the insight! technically if I wanted to make this go faster I think I could unroll array-map
but it's already pretty fast at 150ns
the reason I'm doing this is exploring further saving space by encoding the logical id attr :test/id
in the crux.db/id, and having the mapping be well-known in code instead of encoded in the docs themselves. so far seems promising enough, the extra triple for array-map
only costs like a ~10% overhead on a simple query (90->100us)