Fork me on GitHub
#datomic
<
2017-09-01
>
laujensen16:09:11

I have some items going into a queue, each items goes through a function that needs almost full cpu-load and memory to complete, so only one can go at a time. What idiomatic tools do we have?

marshall17:09:27

+ transducer

laujensen17:09:42

Sorry I meant to post that in #clojure, fortunately Marshell jumps to the rescue 🙂 Thanks I'll have a look

uwo18:09:34

When we need to page a query against a large number of records, and assuming we’re not using a ranged query from the domain, is the next option using d/datoms?

matthavener20:09:52

uwo: yeah, or just do take/drop

favila20:09:37

be careful with that: order is not guaranteed

matthavener20:09:59

good point, that only works after you apply some domain sort

favila20:09:15

given same input, and assuming the result is a set (not a bag), you should be fine

favila20:09:36

but I would sort first

souenzzo21:09:59

(let [conn @config/conn
      schema [{:db/ident       :ref/to-many
               :db/valueType   :db.type/ref
               :db/cardinality :db.cardinality/many
               :db/isComponent true
               ;; ^ 
               :db/id          (d/tempid :db.part/db)}
              {:db/ident       :any/thing
               :db/valueType   :db.type/string
               :db/cardinality :db.cardinality/one
               :db/unique      :db.unique/identity
               :db/id          (d/tempid :db.part/db)}]
      {db :db-after} (d/with (d/db conn) schema)
      tx-data [{:db/id     "user"
                :any/thing "My User"}
               {:db/id       "foo"
                :any/thing   "001"
                :ref/to-many ["user"]}
               {:db/id       "bar"
                :any/thing   "002"
                :ref/to-many ["user"]}]
      {:keys [db-after tempids]} (d/with db tx-data)
      user (d/entity db-after (d/resolve-tempid db-after tempids "user"))]
  (d/touch (:ref/_to-many user)))
There is some way to know if this touch will be on 001 or 002?

favila22:09:42

This violates the isComponent contract: the "user" entity is in more than one datom's :v

souenzzo03:09:00

There is specific docs about it?