Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
allow threading of cassandra cluster options through alia (#146)
Browse files Browse the repository at this point in the history
* store: allow threading of cluster options to alia

* project: bump alia to 3.3.0

* project: wrong dependency

* project: switch to clojure 1.9

* store: do not forward `use` to cluster-options

* store: do not forward `default-region` to cluster-options

* store: store options in cassandra-options key

* fix classpath conflicts if using unilog JSON encoding
  • Loading branch information
pyr committed Feb 8, 2017
1 parent 765456d commit 35d7123
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions project.clj
Expand Up @@ -8,7 +8,7 @@
:main io.pithos
:jvm-opts ["-Xmx2g"]
:profiles {:dev {:resource-paths ["test/data"]}}
:dependencies [[org.clojure/clojure "1.8.0"]
:dependencies [[org.clojure/clojure "1.9.0-alpha14"]
[org.clojure/data.codec "0.1.0"]
[org.clojure/data.xml "0.0.8"]
[org.clojure/data.zip "0.1.1"]
Expand All @@ -21,12 +21,12 @@
[spootnik/uncaught "0.5.3"]
[clj-yaml "0.4.0"]
[clout "2.1.2"]
[cheshire "5.5.0"]
[cheshire "5.6.3"]
[clj-time "0.9.0"]
[ring/ring-core "1.3.2"
:exclusions [org.clojure/tools.reader]]
[ring/ring-codec "1.0.0"]
[cc.qbits/alia "3.1.10"]
[cc.qbits/alia-all "3.3.0"]
[cc.qbits/hayt "3.0.1"]
[cc.qbits/jet "0.7.9"
:exclusions [org.clojure/tools.reader]]
Expand Down
8 changes: 4 additions & 4 deletions src/io/pithos/store.clj
Expand Up @@ -17,15 +17,15 @@
(defn cassandra-store
"Connect to a cassandra cluster, and use a specific keyspace.
When the keyspace is not found, try creating it"
[{:keys [cluster keyspace hints repfactor username password]}]
[{:keys [cassandra-options cluster keyspace hints repfactor username password]}]
(debug "building cassandra store for: " cluster keyspace hints)
(let [hints (or hints
{:replication {:class "SimpleStrategy"
{:replication {:class "SimpleStrategy"
:replication_factor (or repfactor 1)}})
cluster (if (sequential? cluster) cluster [cluster])
session (-> {:contact-points cluster}
session (-> (assoc cassandra-options :contact-points cluster)
(cond-> (and username password)
(assoc :credentials {:user username
(assoc :credentials {:user username
:password password}))
(alia/cluster)
(alia/connect))]
Expand Down

0 comments on commit 35d7123

Please sign in to comment.