Skip to content

Commit

Permalink
Merge pull request #23 from TimoKramer/master
Browse files Browse the repository at this point in the history
Restore release 0.1.9
  • Loading branch information
whilo authored Feb 4, 2021
2 parents c582e65 + 62b4cc5 commit 2360e8e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ pom.xml.asc
*.swo
*.swn
*~
.cpcache/
.shadow-cljs/
24 changes: 12 additions & 12 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
:url "https://github.com/replikativ/hitchhiker-tree"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.520" :scope "provided"]
[org.clojure/core.memoize "0.7.1"]
[com.taoensso/carmine "2.12.2" :scope "provided"]
[org.clojure/core.rrb-vector "0.0.14"]
[org.clojure/core.cache "0.7.2"]
:dependencies [[org.clojure/clojure "1.10.1" :scope "provided"]
[org.clojure/clojurescript "1.10.773" :scope "provided"]
[org.clojure/core.memoize "1.0.236"]
[com.taoensso/carmine "2.20.0" :scope "provided"]
[org.clojure/core.rrb-vector "0.1.1"]
[org.clojure/core.cache "1.0.207"]
[io.replikativ/konserve "0.5.1"]]
:aliases {"bench" ["with-profile" "profiling" "run" "-m" "hitchhiker.bench"]}
:jvm-opts ["-server" "-Xmx3700m" "-Xms3700m"]
Expand All @@ -22,14 +22,14 @@
[org.clojure/tools.cli "0.4.1"]
[org.clojure/test.check "0.9.0"]
[com.infolace/excel-templates "0.3.3"]]}
:dev {:dependencies [[binaryage/devtools "0.9.10"]
[figwheel-sidecar "0.5.18"]
:dev {:dependencies [[binaryage/devtools "1.0.2"]
[figwheel-sidecar "0.5.20"]
[org.clojure/test.check "0.9.0"]
;; plotting
[aysylu/loom "1.0.2"]
[cheshire "5.8.1"]]
[cheshire "5.10.0"]]
:source-paths ["src" "dev" "test"]
:plugins [[lein-figwheel "0.5.18"]]
:plugins [[lein-figwheel "0.5.20"]]
:repl-options {; for nREPL dev you really need to limit output
:init (set! *print-length* 50)}}}
:clean-targets ^{:protect false} ["resources/public/js" "target"]
Expand All @@ -46,7 +46,7 @@
:compiler {:main hitchhiker.tree.core
:asset-path "js/out"
:output-to "resources/public/js/core.js"
:output-dir "resources/public/js/out" }}
:output-dir "resources/public/js/out"}}
;; inspired by datascript project.clj
{:id "test"
:source-paths ["src" "test"]
Expand All @@ -59,5 +59,5 @@
:recompile-dependents false
:parallel-build true}}]}

:plugins [[lein-figwheel "0.5.18"]
:plugins [[lein-figwheel "0.5.20"]
[lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]])
6 changes: 3 additions & 3 deletions src/hitchhiker/tree/key_compare.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@
(-compare [^java.util.Date key1 key2]
(if (instance? java.util.Date key2)
(cond
(< (.getTime key1) (.getTime key2)) -1
(= (.getTime key1) (.getTime key2)) 0
(< (.getTime key1) (.getTime ^java.util.Date key2)) -1
(= (.getTime key1) (.getTime ^java.util.Date key2)) 0
:else 1)
(try
(compare key1 key2)
(catch ClassCastException e
(catch ClassCastException _
(- (n/-order-on-edn-types key2)
(n/-order-on-edn-types key1))))))
nil
Expand Down
23 changes: 23 additions & 0 deletions src/hitchhiker/tree/utils/gc.cljc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(ns hitchhiker.tree.utils.gc
(:require [hitchhiker.tree :as hh]
[hitchhiker.tree.node :as n]
[hitchhiker.tree.bootstrap.konserve :as kons]
[hitchhiker.tree.utils.async :as ha]))

(defn mark
"Return a set of all addresses reachable from gc-roots, corresponding to the
mark phase of a garbage collector."
([gc-roots]
(ha/go-try
(loop [to-visit gc-roots
visited #{}]
(if-let [to-visit (seq to-visit)]
(let [[node & r] to-visit
node (if (hh/resolved? node)
node
(ha/<? (n/-resolve-chan node)))
new-nodes (when (hh/index-node? node)
(:children node))]
(recur (into r new-nodes)
(conj visited (kons/get-root-key node))))
visited)))))
10 changes: 5 additions & 5 deletions test/hitchhiker/redis_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
(take-last 125)
first))
(println (lookup-fwd-iter b-tree -1))
(println (sort s))
))
(println (sort s))))

(defn trial []
(let [opseq (read-string (slurp "broken-data.edn"))
[b-tree root] (reduce (fn [[t root] [op x]]
Expand All @@ -118,8 +118,8 @@
[t @(:storage-addr t)])
:add (do (println "about to add" x-reduced "...")
(let [x [(insert t x-reduced) root]]
(println "added") x
))
(println "added") x))

:del (do (println "about to del" x-reduced "...")
(let [x [(msg/delete t x-reduced) root]]
(println "deled") x)))))
Expand All @@ -141,4 +141,4 @@
(map #(and (second %) (mod (second %) 1000)) opseq)


(def opseq (read-string (io/resource "redis_test_data.clj"))))
(def opseq (read-string (io/resource "test/resources/redis_test_data.clj"))))
2 changes: 2 additions & 0 deletions test/resources/redis_test_data.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

[[:add 37] [:del 40] [:add -3] [:add 9] [:add 23] [:add -5] [:del 9] [:add -37] [:add -22] [:del 19] [:add -9] [:del 11] [:add 23] [:del 4] [:add 1] [:add 26] [:add 16] [:add 34] [:add -32] [:add -12] [:add -30] [:add 27] [:add -35] [:del -11] [:add -6] [:add 28] [:add -32] [:add -2] [:del 15] [:del -22] [:add 8] [:add 0] [:add 30] [:add 36] [:add -7] [:add -2] [:add -34] [:add 5] [:add 6] [:del 38] [:add 34] [:add 24] [:add 20] [:add -23] [:del -34] [:add 0] [:add 27] [:add -10] [:del 4] [:add 38] [:del -40] [:del 40] [:add 9] [:add -35] [:del -7] [:add -32] [:add -38] [:del -5] [:add -22] [:add 18] [:add -2] [:add -9] [:add -26] [:add 16] [:add -3] [:add -6] [:del 18] [:add -6] [:add 40] [:del -36] [:del -35] [:del -17] [:add 32] [:del -30] [:add -37] [:add -36] [:add 10] [:del -15] [:del -6] [:del -22] [:add -21] [:del 32] [:add -9] [:flush] [:add 26] [:add -26] [:add -17] [:add 10] [:add 24] [:add -20] [:add 3] [:add -31] [:add -11] [:add -3] [:add 28] [:add -11] [:add -2] [:add -21] [:add -37] [:add 19] [:del -30] [:add 1] [:add 27] [:del 39] [:add -13] [:add -29] [:add -6] [:add -2] [:del -17] [:add -33] [:add -7] [:add -27] [:add -22] [:add 24] [:add -38] [:add -7] [:add 6] [:del -4] [:add 1] [:add -35] [:add 30] [:add -6] [:add -16] [:add 3] [:add -15] [:del -40] [:add 22] [:add -22] [:add -35] [:add 16] [:add 18] [:add 26] [:add 24] [:add 33] [:add -9] [:del -17] [:add -13] [:add 30] [:add 32] [:add 17] [:del 38] [:add -16] [:add 6] [:add 16] [:add 36] [:add 28] [:add -19] [:add 9] [:add 30] [:del 5] [:add 4] [:add -8] [:del 24] [:add 3] [:add 38] [:add 33] [:add -35] [:add -30] [:add 9] [:add -18] [:add 26] [:add -24] [:add -30] [:add -38] [:add -32] [:add -1] [:del -22] [:add 17] [:add 9] [:add -35] [:add 0] [:add -28] [:add -5] [:add -12] [:add -18] [:add 0] [:add -7] [:add -38] [:add 29] [:add 34] [:add 38] [:add 3] [:add 30] [:add -10] [:add -26] [:del 14] [:add 4] [:add -37] [:add -12] [:add 31] [:add 12] [:del 38] [:add -36] [:add -28] [:del -31] [:flush] [:add -11] [:del 28] [:add -18] [:add 6] [:add 0] [:del 16] [:add 21] [:add 22] [:add 39] [:add -9] [:add -13] [:add -26] [:add -35] [:del 16] [:add 31] [:add 18] [:add 0] [:add -2] [:add -34] [:add 23] [:del -16] [:add -17] [:add 3] [:del -1] [:del 13] [:del -6] [:add 1] [:del 39] [:add 37] [:add -9] [:add 19] [:del 7] [:add -38] [:add 21] [:del 2] [:add 12] [:add 9] [:add 15] [:add 27] [:add 39] [:del 26] [:add -24] [:add 19] [:add -38] [:add 8] [:del -28] [:add 37] [:add -9] [:add 2] [:add -12] [:add -2] [:del -18] [:add 3] [:add -31] [:del -18] [:add -38] [:add -23] [:add 32] [:add -20] [:add 12] [:add -17] [:add 33] [:add 29] [:add -16] [:add 37] [:add -6] [:add -24] [:add 22] [:add 15] [:add -24] [:add -20] [:add 14] [:add 6] [:add -2] [:add -39] [:add 15] [:add -38] [:add 24] [:del -10] [:add -35] [:add 24] [:add 26] [:del 5] [:add -3] [:add -3] [:add -13] [:add -10] [:add 23] [:del 33] [:del 36] [:add 11] [:add 7] [:add 28] [:del -37] [:del 22] [:add 33] [:add 19] [:add 12] [:add -25] [:add -21] [:flush] [:del -31] [:del -35] [:add -27] [:add 26] [:del -7] [:add -2] [:add -35] [:add 16] [:add 10] [:add -8] [:add 16] [:del 11] [:add 25] [:add -14] [:add 8] [:add -1] [:add 22] [:add -4] [:add 9] [:add 12] [:add -13] [:add 11] [:add -35] [:add -39] [:add 40] [:add -6] [:add 25] [:add 39] [:del 20] [:add -38] [:add 26] [:add 36] [:add -31] [:add 36] [:add 37] [:add 7] [:add -13] [:add -27] [:add -16] [:add -13] [:add 18] [:add -30] [:flush] [:add 34] [:add -20] [:add 40] [:add 3] [:add -8] [:add 12] [:add -14] [:add -5] [:del -21] [:add 40] [:add -5] [:add -12] [:add -9] [:add 0] [:add -7] [:del 11] [:add -35] [:add -36] [:add -30] [:add -37] [:add -15] [:add -28] [:del -16] [:add 36] [:del 22] [:add -8] [:del -30] [:add 24] [:del -6] [:add -1] [:add -22] [:del -29] [:add 16] [:add 13] [:add 36] [:del 40] [:add 15] [:add -25] [:add 19] [:add 9] [:del -22] [:add -6] [:del -8] [:del 17] [:add 4] [:add 15] [:add -10] [:add 26] [:add -36] [:add -15] [:add -20] [:del 35] [:del -5] [:add 17] [:add 2] [:add -36] [:add -28] [:add 8] [:add -38] [:add -17] [:add -24] [:add -13] [:add -20] [:add 29] [:add -9] [:add 15] [:add -36] [:del 14] [:add -15] [:add 9] [:add -14] [:add 12] [:add 8] [:add -36] [:add -27] [:add -36] [:del -40] [:del 24] [:del 6] [:add -11] [:add -2] [:add -21] [:add -32] [:add 9] [:add -5] [:add -23] [:add -33] [:add -19] [:add -30] [:add -10] [:add -21] [:add -22] [:add -10] [:del 4] [:add 6] [:add -11] [:add 3] [:del 26] [:add -18] [:add 5] [:add -11] [:add -21] [:add 0] [:add -12] [:add -40] [:add -8] [:add 11] [:add -7] [:add 21] [:add -32] [:add -5] [:add -38] [:add -14] [:add 30] [:add -3] [:del -6] [:flush] [:add -27] [:add 4] [:add 0] [:del -1] [:add 21] [:add -8] [:del -36] [:add 5] [:add 23] [:del 20] [:add -23] [:add 8] [:add 24] [:add -3] [:add -35] [:add -31] [:add -7] [:add 30] [:add 39] [:del -18] [:add 21] [:add 26] [:add -27] [:del 14] [:add 12] [:add 18] [:add 6] [:add -4] [:add -6] [:add -19] [:del -16] [:add -29] [:add -5] [:del 16] [:add 37] [:add 39] [:add -21] [:add 13] [:add 33] [:add -33] [:add 32] [:add -2] [:add -5] [:del 23] [:add -14] [:add -14] [:add -39] [:add 12] [:add -12] [:add 33] [:add 1] [:add 29] [:add 19] [:add 3] [:add 17] [:del 37] [:add -14] [:add 5] [:del -2] [:add -3] [:add 25] [:add -26] [:add 3] [:add 30] [:add 28] [:add -16] [:del 9] [:add 40] [:add 21] [:add 15] [:add 22] [:del -19] [:add -13] [:add 8] [:add 23] [:add -26] [:add 9] [:add 2] [:add -5] [:add 3] [:add 37] [:add 23] [:add -40] [:add 8] [:add -19] [:add 23] [:del -27] [:add 9] [:add 35] [:add -29] [:add -19] [:add -11] [:add -16] [:del 27] [:add -18] [:add 26] [:add 40] [:add 34] [:del 15] [:add 20] [:add 10] [:add 40] [:del -13] [:del 4] [:add -34] [:del -19] [:add -21] [:add 1] [:add 39] [:del -24] [:del 2] [:add -5] [:add -26] [:del 35] [:add 24] [:add -4] [:add -7] [:add -26] [:add 9] [:del 0] [:add 37] [:add 1] [:add -28] [:add 18] [:add 31] [:add 31] [:add 38] [:del 28] [:add -27] [:add 38] [:add -16] [:add 5] [:add 27] [:add 27] [:add -17] [:add -1] [:add 4] [:add -32] [:del -32] [:del -18] [:add 1] [:add -3] [:add -19] [:add -10] [:add 37] [:add -16] [:add 24] [:add -30] [:del 21] [:add 35] [:add -24] [:add 11] [:add -36] [:add -24] [:add -35] [:add -36] [:add 8] [:add 40] [:add -22] [:add 10] [:add 6] [:del -22] [:del -12] [:add 5] [:add 21] [:add 27] [:add 11] [:add -17] [:del 37] [:add -7] [:add 24] [:add 13] [:add -26] [:add 32] [:del 27] [:add -28] [:add -8] [:add 14] [:add -31] [:add -2] [:add -24] [:del 2] [:add -38] [:del 23] [:del -30] [:add 28] [:add -34] [:add 18] [:del -27] [:del 23] [:add -19] [:del 20] [:add -31] [:add 0] [:add 1] [:del -26] [:add 39] [:add 26] [:del 31] [:add 35] [:del -34] [:del 1] [:del 24] [:del 23] [:add -14] [:add -2] [:del -37] [:del 17] [:add -7] [:add 7] [:add 35] [:add 8] [:add -19] [:add -11] [:add -12] [:add -22] [:add 32] [:del 20] [:add 7] [:add -36] [:add -30] [:add 10] [:add -23] [:add 4] [:add 19] [:add -17] [:add 25] [:add 18] [:add -1] [:add -37] [:add -25] [:add -37] [:add -34] [:add 21] [:add -27] [:add -27] [:add -18] [:add -31] [:add 38] [:add -17] [:add -2] [:add -15] [:add 36] [:del -23] [:add 34] [:add -1] [:add -36] [:del 15] [:add 29] [:add 17] [:add -22] [:add 37] [:add 15] [:del -23] [:add 30] [:add -4] [:add 3] [:add 4] [:add -2] [:add 20] [:add -16] [:del 39] [:add -1] [:add 3] [:del -14] [:add -38] [:del -25] [:add 29] [:add -24] [:del 26] [:add 35] [:del 7] [:add -5] [:del 7] [:add 40] [:add -33] [:add 34] [:add 26] [:add 34] [:del 20] [:add 31] [:add 33] [:add 38] [:add 19] [:del 17] [:add 19] [:add -25] [:add -10] [:add -37] [:add 8] [:add -21] [:add 13] [:add 25] [:add 30] [:add 25] [:add -26] [:del -25] [:del -34] [:add 5] [:add -35] [:add 39] [:add -33] [:add 27] [:del 40] [:flush] [:add -34] [:add 10] [:del -21] [:add -8] [:add 22] [:add -4] [:add 38] [:add -17] [:add -34] [:add 34] [:add -20] [:add 30] [:del -1] [:add -3] [:del 7] [:add 21] [:del 24] [:add 17] [:del -38] [:add -2] [:del 9] [:del 11] [:add -2] [:add 3] [:add 35] [:add 8] [:del -6] [:add -37] [:add 17] [:del -35] [:add -32] [:add -13] [:add 7] [:add 21] [:del -18] [:del 34] [:add -26] [:del -27] [:add -21] [:add 4] [:add -36] [:del -4] [:add 9] [:del -21] [:add -15] [:add -4] [:del 4] [:add 0] [:add 15] [:add -30] [:del 12] [:del 33] [:add -22] [:add -19] [:add -22] [:add -12] [:add -2] [:flush] [:add -20] [:add -20] [:add -33] [:add -17] [:del 1] [:add -2] [:add 38] [:add -39] [:add 14] [:add -8] [:add -19] [:add 7] [:add -13] [:del 39] [:add 38] [:del -14] [:del -40] [:del -18] [:add 38] [:del 0] [:add 37] [:add -16] [:add -29] [:del 30] [:add 16] [:add -31] [:del -2] [:add 37] [:add -10] [:add -26] [:add 33] [:add -23] [:add -14] [:add -18] [:del 10] [:add 5] [:add -14] [:add -22] [:del 32] [:add -25] [:add -40] [:add -12] [:add -21] [:add -9] [:add -32] [:add 28] [:add -21] [:add 13] [:del -21] [:del 31] [:add 10] [:add -11] [:del -17] [:add -25] [:add 9] [:add 0] [:add -22] [:del 7] [:add -38] [:add 4] [:add -5] [:add -13] [:add 14] [:del 26] [:add 18] [:add -18] [:add 5] [:add 32] [:add 17] [:add -5] [:del -30] [:add -34] [:add -22] [:add -33] [:add -2] [:del 1] [:add 22] [:add 39] [:add 21] [:add -38] [:add 1] [:add 23] [:add 17] [:add 5] [:del -18] [:add -14] [:add 30] [:del 37] [:add 3] [:add -39] [:add -1] [:del 22] [:add 39] [:del -26] [:del -26] [:add -37] [:del 5] [:add 26] [:add -20] [:add -21] [:del 6] [:add -20] [:add 36] [:add 7] [:del 11] [:add -26] [:del 6] [:add -17] [:del -17] [:add -30] [:add 1] [:del -35] [:add 4] [:del -17] [:add -6] [:del 9] [:add 34] [:add -35] [:add 8] [:add -11] [:del -1] [:add 13] [:add 20] [:add -22] [:add 7] [:add -13] [:add -24] [:add -37] [:add 32] [:add -30] [:del -34] [:del -31] [:add 19] [:flush] [:add 38] [:add 9] [:add -29] [:add -32] [:del -23] [:del 8] [:del -6] [:add 17] [:add -34] [:add -15] [:del 13] [:add -40] [:add 37] [:add -18] [:add 33] [:add -9] [:add -23] [:add -37] [:add 2] [:add 16] [:add 20] [:add -8] [:add -28] [:add -27] [:add -20] [:add 20] [:add 26] [:add -38] [:add -2] [:add -21] [:add 17] [:add 9] [:del 32] [:del 1] [:add -4] [:add -3] [:del -9] [:add -21] [:add -31] [:add -19] [:add 12] [:add 14] [:add -33] [:del -33] [:del -9] [:add -22]]

0 comments on commit 2360e8e

Please sign in to comment.