factual / clj-leveldb Goto Github PK
View Code? Open in Web Editor NEWClojure bindings for LevelDB
Clojure bindings for LevelDB
When I use Clojure 1.6 with 0.1.1, on OS X, it looks like there's a race condition in the iterator. When I do (count (clj-leveldb/iterator <my-db>))
I almost immediately get an error, libc++abi.dylib: pure virtual method called.
When I (count (map (fn [x] (Thread/sleep 1) x) (clj-leveldb/iterator <my-db>))
I don't see this problem.
When I use Clojure 1.5.1 with 0.1.0, on OS X, everything works great.
(def db (clj-leveldb/create-db "/tmp/leveldb" {:key-decoder byte-streams/to-string :val-decoder byte-streams/to-string}))
(clj-leveldb/iterator db)
;=> java.lang.NullPointerException
(clj-leveldb/put db "foo" "bar")
(clj-leveldb/iterator db)
;=> (["foo" "bar"])
(clj-leveldb/iterator db "z")
;=> java.lang.NullPointerException
I would expect clj-leveldb/iterator
to return an empty closeable seq instead of throwing a NullPointerException.
newer byte-streams versions (2+) include a newer version of clj-tuple which avoids the issue which older versions of clj-tuple hae with failing runtime spec validation for a call to defn-.
anyone trying to use clj-leveldb with the latest clojure alphas will get this error when trying to require clj-leveldb:
Starting nREPL server...
C:\dev\jdk\bin\java -Dfile.encoding=Cp1252 -XX:-OmitStackTraceInFastThrow -Dclojure.compile.path=C:\dev\workspace\compose\target\classes -Dcompose.version=0.1.0-SNAPSHOT -Dclojure.debug=false -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2\bin" -classpath "C:\dev\workspace\compose\test;C:\dev\workspace\compose\src;C:\dev\workspace\compose\dev-resources;C:\dev\workspace\compose\resources;C:\dev\workspace\compose\target\classes;C:\Users\sub\.m2\repository\clj-tuple\clj-tuple\0.1.5\clj-tuple-0.1.5.jar;C:\Users\sub\.m2\repository\factual\clj-leveldb\0.1.1\clj-leveldb-0.1.1.jar;C:\Users\sub\.m2\repository\org\clojure\clojure\1.9.0-alpha13\clojure-1.9.0-alpha13.jar;C:\Users\sub\.m2\repository\org\clojure\tools.nrepl\0.2.12\tools.nrepl-0.2.12.jar;C:\Users\sub\.m2\repository\com\google\javascript\closure-compiler-externs\v20160315\closure-compiler-externs-v20160315.jar;C:\Users\sub\.m2\repository\clojure-complete\clojure-complete\0.2.4\clojure-complete-0.2.4.jar;C:\Users\sub\.m2\repository\args4j\args4j\2.0.26\args4j-2.0.26.jar;C:\Users\sub\.m2\repository\org\clojure\google-closure-library-third-party\0.0-20160609-f42b4a24\google-closure-library-third-party-0.0-20160609-f42b4a24.jar;C:\Users\sub\.m2\repository\org\clojure\google-closure-library\0.0-20160609-f42b4a24\google-closure-library-0.0-20160609-f42b4a24.jar;C:\Users\sub\.m2\repository\byte-streams\byte-streams\0.1.13\byte-streams-0.1.13.jar;C:\Users\sub\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\sub\.m2\repository\org\iq80\leveldb\leveldb-api\0.7\leveldb-api-0.7.jar;C:\Users\sub\.m2\repository\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\sub\.m2\repository\org\clojure\data.json\0.2.6\data.json-0.2.6.jar;C:\Users\sub\.m2\repository\org\clojure\tools.reader\1.0.0-beta3\tools.reader-1.0.0-beta3.jar;C:\Users\sub\.m2\repository\primitive-math\primitive-math\0.1.3\primitive-math-0.1.3.jar;C:\Users\sub\.m2\repository\com\google\javascript\closure-compiler-unshaded\v20160315\closure-compiler-unshaded-v20160315.jar;C:\Users\sub\.m2\repository\org\mozilla\rhino\1.7R5\rhino-1.7R5.jar;C:\Users\sub\.m2\repository\org\clojure\clojurescript\1.9.229\clojurescript-1.9.229.jar;C:\Users\sub\.m2\repository\com\google\guava\guava\19.0\guava-19.0.jar;C:\Users\sub\.m2\repository\org\fusesource\leveldbjni\leveldbjni-all\1.8\leveldbjni-all-1.8.jar;C:\Users\sub\.m2\repository\com\google\protobuf\protobuf-java\2.5.0\protobuf-java-2.5.0.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain clojure.main -i C:\Users\sub\AppData\Local\Temp\form-init2785844419347275116.clj
#error {
:cause Call to clojure.core/defn- did not conform to spec:
In: [0] val: clj-tuple/conj-tuple fails spec: :clojure.core.specs/defn-args at: [:args :name] predicate: simple-symbol?
:clojure.spec/args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))
:data #:clojure.spec{:problems [{:path [:args :name], :pred simple-symbol?, :val clj-tuple/conj-tuple, :via [:clojure.core.specs/defn-args :clojure.core.specs/defn-args], :in [0]}], :args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))}
:via
[{:type clojure.lang.Compiler$CompilerException
:message clojure.lang.ExceptionInfo: Call to clojure.core/defn- did not conform to spec:
In: [0] val: clj-tuple/conj-tuple fails spec: :clojure.core.specs/defn-args at: [:args :name] predicate: simple-symbol?
:clojure.spec/args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))
#:clojure.spec{:problems [{:path [:args :name], :pred simple-symbol?, :val clj-tuple/conj-tuple, :via [:clojure.core.specs/defn-args :clojure.core.specs/defn-args], :in [0]}], :args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))}, compiling:(clj_tuple.clj:556:1)
:at [clojure.lang.Compiler load Compiler.java 7441]}
{:type clojure.lang.ExceptionInfo
:message Call to clojure.core/defn- did not conform to spec:
In: [0] val: clj-tuple/conj-tuple fails spec: :clojure.core.specs/defn-args at: [:args :name] predicate: simple-symbol?
:clojure.spec/args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))
:data #:clojure.spec{:problems [{:path [:args :name], :pred simple-symbol?, :val clj-tuple/conj-tuple, :via [:clojure.core.specs/defn-args :clojure.core.specs/defn-args], :in [0]}], :args (clj-tuple/conj-tuple [t__766__unified__ x__767__unified__] (clojure.core/let [t__766__unified__ t__766__unified__] (clojure.core/case (.count t__766__unified__) 0 (new Tuple1 x__767__unified__ (clojure.core/meta t__766__unified__)) 1 (new Tuple2 (. t__766__unified__ e0) x__767__unified__ (clojure.core/meta t__766__unified__)) 2 (new Tuple3 (. t__766__unified__ e0) (. t__766__unified__ e1) x__767__unified__ (clojure.core/meta t__766__unified__)) 3 (new Tuple4 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) x__767__unified__ (clojure.core/meta t__766__unified__)) 4 (new Tuple5 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) x__767__unified__ (clojure.core/meta t__766__unified__)) 5 (new Tuple6 (. t__766__unified__ e0) (. t__766__unified__ e1) (. t__766__unified__ e2) (. t__766__unified__ e3) (. t__766__unified__ e4) x__767__unified__ (clojure.core/meta t__766__unified__)) 6 (clojure.core/let [t__766__unified__ t__766__unified__] (clj_tuple.VectorSeq. 0 7 (clojure.core/-> [] clojure.core/transient (clojure.core/conj! (.nth t__766__unified__ 0)) (clojure.core/conj! (.nth t__766__unified__ 1)) (clojure.core/conj! (.nth t__766__unified__ 2)) (clojure.core/conj! (.nth t__766__unified__ 3)) (clojure.core/conj! (.nth t__766__unified__ 4)) (clojure.core/conj! (.nth t__766__unified__ 5)) (clojure.core/conj! x__767__unified__) clojure.core/persistent!) (clojure.core/meta t__766__unified__))))))}
:at [clojure.core$ex_info invokeStatic core.clj 4725]}]
:trace
[[clojure.core$ex_info invokeStatic core.clj 4725]
[clojure.spec$macroexpand_check invokeStatic spec.clj 681]
[clojure.spec$macroexpand_check invoke spec.clj 670]
[clojure.lang.AFn applyToHelper AFn.java 156]
[clojure.lang.AFn applyTo AFn.java 144]
DBComparator is not interface, so i couldn't use defrecord.
Seems like the latest on clojars is 0.1.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.