clojurewerkz.cassaforte.client

Provides fundamental functions for

* connecting to Cassandra nodes and clusters
* configuring connections
* tuning load balancing, retries, reconnection strategies and consistency settings
* preparing and executing queries constructed via DSL
* working with executing results

*fetch-size*

dynamic

->DummySessionImpl

(->DummySessionImpl)
Positional factory function for class clojurewerkz.cassaforte.client.DummySessionImpl.

as-prepared

(as-prepared query & values)
Helper method to create prepared query from `query` string with `?` placeholders and values
to be bound to the query.

build-cluster

(build-cluster {:keys [hosts port credentials connections-per-host max-connections-per-host consistency-level retry-policy reconnection-policy load-balancing-policy force-prepared-queries ssl ssl-options kerberos protocol-version compression], :or {protocol-version 2}})
Builds an instance of Cluster you can connect to.

Options:
  * hosts: hosts to connect to
  * port: port, listening to incoming binary CQL connections (make sure you have `start_native_transport` set to true).
  * credentials: connection credentials in the form {:username username :password password}
  * connections-per-host: specifies core number of connections per host.
  * max-connections-per-host: maximum number of connections per host.
  * retry-policy: configures the retry policy to use for the new cluster.
  * load-balancing-policy: configures the load balancing policy to use for the new cluster.
  * force-prepared-queries: forces all queries to be executed as prepared by default
  * consistency-level: default consistency level for all queires to be executed against this cluster
  * ssl: ssl options in the form {:keystore-path path :keystore-password password} Also accepts :cipher-suites with a Seq of cipher suite specs.
  * ssl-options: pre-built SSLOptions object (overrides :ssl)
  * kerberos: enables kerberos authentication

compile-query

(compile-query query-params builder)
Compiles query from given `builder` and `query-params`

connect

(connect hosts)(connect hosts keyspace-or-opts)(connect hosts keyspace opts)
Connects to the Cassandra cluster. Use `build-cluster` to build a cluster.

connect-with-uri

(connect-with-uri uri)(connect-with-uri uri opts)

disconnect

(disconnect session)
1-arity version receives Session, and shuts it down. It doesn't shut down all other sessions
on same cluster.

disconnect!

(disconnect! session)
Shuts the cluster and session down.  If you have other sessions, use the safe `disconnect` function instead.

DummySession

protocol

members

executeAsync

(executeAsync _ query)

execute

(execute session query)(execute session query {:keys [prepared fetch-size]})
Executes a pre-built query.

Options
  * prepared - whether the query should or should not be executed as prepared, always passed
    explicitly, because `execute` is considered to be a low-level function.

execute-async

(execute-async session query)(execute-async session query {:keys [prepared]})
Executes a pre-built query and returns a future.

Options
  * prepared - whether the query should or should not be executed as prepared, always passed
    explicitly, because `execute` is considered to be a low-level function.

export-schema

(export-schema client)
Exports the schema as a string

get-hosts

(get-hosts session)
Returns all nodes in the cluster

get-result

(get-result future)(get-result future timeout-ms)
Get result from Future. Optional `timeout-ms` should be specified in milliseconds.

prepare

(prepare session query)
Prepares the provided query on C* server for futher execution.

This assumes that query is valid. Returns the prepared statement corresponding to the query.

prepared

macro

(prepared & body)
Same as cassaforte.policies/forcing-prepared-statements. Kept for backwards
compatibility.

render-query

(render-query query-params)
Renders compiled query

set-callbacks

(set-callbacks fut {:keys [success failure]})
Set callbacks on a result future

shutdown-cluster

(shutdown-cluster cluster)
Shuts down provided cluster

with-fetch-size

macro

(with-fetch-size n# & body)
Temporarily alters fetch size.