Fork me on GitHub

Given: (defn crux-standalone-in-memory-start [] (def ^crux.api.ICruxAPI node (crux/start-node {:crux.node/topology 'crux.standalone/topology :crux.node/kv-store 'crux.kv.memdb/kv :crux.kv/db-dir "data/db-dir-1" :crux.standalone/event-log-dir "data/eventlog-1" :crux.standalone/event-log-kv-store 'crux.kv.memdb/kv})) node) (def node (crux-standalone-in-memory-start)) executing: (crux/status node) works as documented in, but executing: (crux/sync node) results in the following error: Syntax error (IllegalArgumentException) compiling crux/sync at (src/crux_rbac/rbac_crux.clj:70:3). No single method: sync of interface: crux.api.PCruxNode found for function: sync of protocol: PCruxNode Any thoughts?


Hi again, we haven't quite released the zero-arity version of sync yet as it only got added last week 🙂 See: ...I guess the docs are currently out-of-sync in this regard! We will also need to add it to the Changelog before the next release, which should be within the next week or so. The simplest thing for you to do as it stands is add a timeout duration argument.


And sorry for the confusion!


The docs say "timeout" can be nil for the default. What's the syntax for a duration?


Ah yes, a nil should work. A timeout looks like: (sync node Duration/ofMillis 10000))


(you also need (:import java.time.Duration) at the top of your ns)


I'm exploring some options for a requirement to have some type of bitemporal database in our architecture


so, initially looking at Crux and Datomic


I'm just after reading this article, written in 2017 wrt Datomic and accessing revisions of a document


It suggests that if attributes are added to a model at a point in time, then you can't query for entities added before the new attributes have been added


Is this something that Crux supports? (I definitely have a usecase where the model will evolve over time)


more specifically - you can't query for the non-existence of an attribute, which means you have to query on an attribute that existed at some point in time to query for it 🙂


(in Datomic)


in other words, if you want to find "person by name" or something like that, you can't query for "person by name" and expect to find data that doesn't include that attribute because it didn't exist in the system yet


but you can do what you would typically do in any other db - when you add a new attribute, you can put data in the database for all pre-existing entities


(sorry, don't know the answer for crux, just felt like clarifying the Datomic part)


right right, I see 🙂


Hey @dharrigan yep in Crux you can update an entity with new attributes (as a new document version) at any point in the ("valid") timeline and still query the old versions of that entity


makes sense of course, can't query for something that didn't exist before then.


Hi Jeremy - from augustl's explaination, it seems that datomic has similar, i.e., if I add a new attribute to a model, I can only query upon that model for that attribute up to when that attribute came in existance. Would that be the same in Crux, i.e., if I query on an attribute that was added today, then the query would only find entities up to today (if that attribute is part of the query) - hope that make sense 🙂


If I strip out that attribute from the query, then both crux and datomic would resolve more entities (because it finds more entities without that attribute in the past)


Okay yeah I guess there's fundamentally no getting around the task of updating the database "for all pre-existing entities" if you want to be able to run the new queries against the existing data. One workaround is to add a bunch of extra clauses in your datalog to allow for attributes that optionally exist: ...but I can't comment on how practical this is as a long-term strategy! Maybe it is enough.


Sure, thank you. It's very helpful. I guess it's analogous to adding a new nullable field in a RDBMS, then maybe defaulting the value, so that from that point onwards, you can query all the existing rows in the table for the value of the field

👍 4

(even if it doesn't make real sense for prior rows, at least you can query from this point onwards for interesting values)


Thank you @taylor.jeremydavid and @augustl for clarifying! Exciting stuff!

🙏 4
🎉 4