replikativ / datahike

A fast, immutable, distributed & compositional Datalog engine for everyone.
https://datahike.io
Eclipse Public License 1.0
1.62k stars 95 forks source link

[Bug]: as-of is not compatible with datomic as-of #572

Closed kordano closed 1 year ago

kordano commented 1 year ago

What version of Datahike are you using?

0.5.1515

What version of Java are you using?

openjdk version "19" 2022-09-20

What operating system are you using?

macos ventura 13.0

What database EDN configuration are you using?

{:store {:backend :mem, :id "testing"},
 :schema-flexibility :write,
 :attribute-refs? true,
 :index :datahike.index/persistent-set,
 :middleware {:query [datahike.middleware.query/timed-query]},
 :keep-history true,
 :name "in-mem"}

Describe the bug

as-of is using timepoints as transaction IDs or transaction IDs. In Datomic you can also use a point in time given by the database as described in the datomic ref.

What is the expected behaviour?

Integers that represent the transaction index should also work.

How can the behaviour be reproduced?

(require '[datahike.api :as d])

(def cfg {:store              {:backend :mem
                               :id      "testing"}
          :schema-flexibility :write
          :attribute-refs?    true
          :index              :datahike.index/persistent-set
          :middleware         {:query ['datahike.middleware.query/timed-query]}
          :keep-history       true
          :name               "in-mem"})

(def conn (d/connect cfg))

(d/q '[:find ?tx
       :in $ ?version
       :where
       [?t :taxonomy-version/id ?version]
       [?t :taxonomy-version/tx ?tx]]
     (d/as-of @conn 15)
     )