   [^Cluster cluster]
   (.close cluster))
 
-(def ^:dynamic *async* false)
-
-(defmacro async
-  "Prepare a single statement, return prepared statement"
-  [body]
-  `(binding [*async* true]
-     (do ~body)))
-
-(defmacro with-fetch-size
-  "Temporarily alters fetch size."
-  [^Integer n# & body]
-  `(binding [*fetch-size* ~n#]
-     (do ~@body)))
-
-(defn- set-statement-options-
-  [^Statement statement]
-  (when cp/*retry-policy*
-    (.setRetryPolicy statement cp/*retry-policy*))
-  (when cp/*consistency-level*
-    (.setConsistencyLevel statement (cp/resolve-consistency-level cp/*consistency-level*)))
-  statement)
-
 (defn ^:private build-statement-
   "Builds a Prepare or Simple statement out of given params.
 

(declare build-ssl-options select-compression)

(def ^:dynamic *fetch-size*)

(defprotocol DummySession
  (executeAsync [_ query]))

(deftype DummySessionImpl []
  DummySession
  (executeAsync [_ query] (throw (Exception. "Not connected"))))

(defprotocol BuildStatement
  (build-statement [query]))

(extend-protocol BuildStatement
  String
  (build-statement [query]
    (build-statement (SimpleStatement. query)))

  clojure.lang.IPersistentMap
  (build-statement [raw-statement]
    (build-statement (hayt/->raw raw-statement)))

  Statement
  (build-statement [s]
    s))

(defprotocol Listenable
  (add-listener [_ runnable executor]))

(deftype AsyncResult [fut]
  clojure.lang.IDeref
  (deref [_]
    (conv/to-clj @fut))

  clojure.lang.IBlockingDeref
  (deref [_ time-period time-unit]
    (conv/to-clj (deref fut time-period time-unit)))

  Listenable
  (add-listener [_ runnable executor]
    (.addListener fut runnable executor)))

;;
;; Fns
;;

(defn ^Cluster build-cluster
  "Builds an instance of Cluster you can connect to.
