From 62b4cc51919d8d0615d7fd9bfcbcfc98b099dd43 Mon Sep 17 00:00:00 2001 From: Timo Kramer Date: Mon, 25 Jan 2021 20:16:47 +0100 Subject: [PATCH] Restore release 0.1.9 --- .gitignore | 2 ++ project.clj | 24 ++++++++++++------------ src/hitchhiker/tree/key_compare.cljc | 6 +++--- src/hitchhiker/tree/utils/gc.cljc | 23 +++++++++++++++++++++++ test/hitchhiker/redis_test.clj | 10 +++++----- test/resources/redis_test_data.clj | 2 ++ 6 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 src/hitchhiker/tree/utils/gc.cljc create mode 100644 test/resources/redis_test_data.clj diff --git a/.gitignore b/.gitignore index 8fc68fb6..0813bcad 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ pom.xml.asc *.swo *.swn *~ +.cpcache/ +.shadow-cljs/ diff --git a/project.clj b/project.clj index 0e8cadd6..cdfa0208 100644 --- a/project.clj +++ b/project.clj @@ -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"] @@ -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"] @@ -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"] @@ -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]]]]) diff --git a/src/hitchhiker/tree/key_compare.cljc b/src/hitchhiker/tree/key_compare.cljc index 059224bc..f3e08030 100644 --- a/src/hitchhiker/tree/key_compare.cljc +++ b/src/hitchhiker/tree/key_compare.cljc @@ -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 diff --git a/src/hitchhiker/tree/utils/gc.cljc b/src/hitchhiker/tree/utils/gc.cljc new file mode 100644 index 00000000..c3f5425a --- /dev/null +++ b/src/hitchhiker/tree/utils/gc.cljc @@ -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/