Skip to content

Commit

Permalink
Varargs
Browse files Browse the repository at this point in the history
  • Loading branch information
evg-tso committed Jan 14, 2024
1 parent 35c390e commit 32a4d67
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/main/clojure/aerospike_clj/batch_client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@

(extend-type SimpleAerospikeClient
pt/AerospikeBatchOps
(batch-operate [this batch-records]
(pt/batch-operate this batch-records {}))

(batch-operate [this batch-records conf]
(let [op-future (p/deferred)
policy (:policy conf)
batch-list (if (list? batch-records)
batch-records
(into [] batch-records))
start-time (System/nanoTime)
transcoder (:transcoder conf identity)]
(.operate ^AerospikeClient (.-client this)
^EventLoop (.next ^EventLoops (.-el this))
^BatchOperateListListener (AsyncBatchOperateListListener. op-future)
^BatchPolicy policy
^List batch-list)
(-> op-future
(p/then' (comp transcoder #(collections/->list batch-record->map %)) (.-completion-executor this))
(client/register-events (.-client-events this) :batch-operate nil start-time conf)))))
(batch-operate
([this batch-records]
(pt/batch-operate this batch-records {}))
([this batch-records conf]
(let [op-future (p/deferred)
policy (:policy conf)
batch-list (if (list? batch-records)
batch-records
(into [] batch-records))
start-time (System/nanoTime)
transcoder (:transcoder conf identity)]
(.operate ^AerospikeClient (.-client this)
^EventLoop (.next ^EventLoops (.-el this))
^BatchOperateListListener (AsyncBatchOperateListListener. op-future)
^BatchPolicy policy
^List batch-list)
(-> op-future
(p/then' (comp transcoder #(collections/->list batch-record->map %)) (.-completion-executor this))
(client/register-events (.-client-events this) :batch-operate nil start-time conf))))))
5 changes: 3 additions & 2 deletions test/aerospike_clj/integration/integration_test.clj
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
(ns ^{:author "Ido Barkan"
:integration true}
aerospike-clj.integration.integration-test
(:require [clojure.test :refer [deftest testing is use-fixtures]]
(:require [aerospike-clj.batch-client]
[clojure.test :refer [deftest testing is use-fixtures]]
[cheshire.core :as json]
[aerospike-clj.integration.aerospike-setup :as as-setup]
[aerospike-clj.client :as client]
[aerospike-clj.protocols :as pt]
[aerospike-clj.policy :as policy]
[aerospike-clj.key :as as-key]
[aerospike-clj.utils :as utils]
[clojure.tools.logging :as log]
[spy.core :as spy])
(:import (com.aerospike.client Value AerospikeClient BatchWrite Operation Bin)
(com.aerospike.client.cdt ListOperation ListPolicy ListOrder ListWriteFlags ListReturnType
Expand All @@ -28,7 +30,6 @@
(def ^:dynamic *as-hosts* nil)
(def TTL 5)


(defn with-db-connection [test-fn]
(let [as-hosts [(as-setup/get-host-and-port)]]
(binding [*c* (client/init-simple-aerospike-client
Expand Down

0 comments on commit 32a4d67

Please sign in to comment.