Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
evg-tso committed Aug 8, 2023
1 parent ca3978b commit f39896e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
28 changes: 14 additions & 14 deletions src/main/clojure/aerospike_clj/client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
^Key (pt/create-key index dbns set-name)
^"[Ljava.lang.String;" (utils/v->array String bin-names)))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/record->map completion-executor))))
(.thenApplyAsync functions/record->map-function completion-executor))))

(get-single-no-meta [this index set-name]
(-> ^CompletableFuture (pt/get-single this index set-name)
(.thenApply functions/extract-payload)))
(.thenApply functions/extract-payload-function)))

(get-single-no-meta [this index set-name bin-names]
(-> ^CompletableFuture (pt/get-single this index set-name {} bin-names)
(.thenApply functions/extract-payload)))
(.thenApply functions/extract-payload-function)))

(exists? [this index set-name]
(pt/exists? this index set-name {}))
Expand All @@ -136,7 +136,7 @@
^Policy (:policy conf)
^Key (pt/create-key index dbns set-name))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

(get-batch [this batch-reads]
(pt/get-batch this batch-reads {}))
Expand All @@ -150,7 +150,7 @@
^BatchPolicy (:policy conf)
^List batch-reads-arr)
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/mapv-batch-record->map completion-executor))))
(.thenApplyAsync functions/mapv-batch-record->map-function completion-executor))))

(exists-batch [this indices]
(pt/exists-batch this indices {}))
Expand All @@ -164,7 +164,7 @@
^BatchPolicy (:policy conf)
^"[Lcom.aerospike.client.Key;" indices)
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/->vec completion-executor))))
(.thenApplyAsync functions/vec-function completion-executor))))

pt/AerospikeWriteOps
(put [this index set-name data expiration]
Expand Down Expand Up @@ -269,7 +269,7 @@
^WritePolicy (policy/write-policy client expiration RecordExistsAction/UPDATE_ONLY)
^Key (pt/create-key index dbns set-name))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

pt/AerospikeDeleteOps
(delete [this index set-name]
Expand All @@ -283,7 +283,7 @@
^WritePolicy (:policy conf)
^Key (pt/create-key index dbns set-name))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

(delete-bins [this index set-name bin-names new-expiration]
(pt/delete-bins this index set-name bin-names new-expiration {}))
Expand All @@ -298,7 +298,7 @@
^Key (pt/create-key index dbns set-name)
^"[Lcom.aerospike.client.Bin;" (utils/v->array Bin (mapv bins/set-bin-as-null bin-names)))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

pt/AerospikeSingleIndexBatchOps
(operate [this index set-name expiration operations]
Expand All @@ -315,7 +315,7 @@
^Key (pt/create-key index dbns set-name)
(utils/v->array Operation operations))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/record->map completion-executor)))))
(.thenApplyAsync functions/record->map-function completion-executor)))))

pt/AerospikeBatchOps
(batch-operate [this batch-records]
Expand All @@ -335,7 +335,7 @@
^BatchPolicy policy
^List batch-list)
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/mapv-batch-record->map completion-executor))))
(.thenApplyAsync functions/mapv-batch-record->map-function completion-executor))))


pt/AerospikeSetOps
Expand All @@ -352,7 +352,7 @@
set-name
(when bin-names ^"[Ljava.lang.String;" (utils/v->array String bin-names)))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

pt/AerospikeAdminOps
(info [this node info-commands]
Expand All @@ -367,7 +367,7 @@
^Node node
(into-array String info-commands))
(-> ^CompletableFuture op-future
(.thenApplyAsync functions/identity completion-executor))))
(.thenApplyAsync functions/identity-function completion-executor))))

(get-nodes [_this]
(into [] (.getNodes ^AerospikeClient client)))
Expand All @@ -392,7 +392,7 @@
@(pt/put this k set-name v ttl)
(= v
(-> ^CompletableFuture (pt/get-single this k set-name {:policy read-policy})
(.thenApply functions/extract-payload)
(.thenApply functions/extract-payload-function)
deref))
(catch Exception _ex
false))))
Expand Down
10 changes: 5 additions & 5 deletions src/main/clojure/aerospike_clj/functions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
(:require [aerospike-clj.aerospike-record :as record])
(:import (java.util.function Function)))

(def ^Function identity
(def ^Function identity-function
(reify Function
(apply [_ x]
x)))

(def ^Function record->map
(def ^Function record->map-function
(reify Function
(apply [_ record]
(record/record->map record))))

(def ^Function mapv-batch-record->map
(def ^Function mapv-batch-record->map-function
(reify Function
(apply [_ batch-records]
(mapv record/batch-record->map batch-records))))

(def ^Function extract-payload
(def ^Function extract-payload-function
(reify Function
(apply [_ m]
(:payload m))))

(def ^Function ->vec
(def ^Function vec-function
(reify Function
(apply [_ batch-response]
(vec batch-response))))
7 changes: 3 additions & 4 deletions src/main/clojure/aerospike_clj/mock_client.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
[aerospike-clj.utils])
(:import (com.aerospike.client AerospikeException ResultCode)
(java.time Clock Instant ZoneOffset)
(java.util.concurrent CompletableFuture)
(java.util.function Function)))
(java.util.concurrent CompletableFuture)))

(def ^:private DEFAULT_SET "__DEFAULT__")
(def FIXED_CLOCK (Clock/fixed (Instant/parse "2022-01-01T00:00:00.00Z") ZoneOffset/UTC))
Expand Down Expand Up @@ -66,11 +65,11 @@

(get-single-no-meta [this k set-name]
(-> ^CompletableFuture (pt/get-single this k set-name)
(.thenApply functions/extract-payload)))
(.thenApply functions/extract-payload-function)))

(get-single-no-meta [this k set-name bin-names]
(-> ^CompletableFuture (pt/get-single this k set-name {} bin-names)
(.thenApply functions/extract-payload)))
(.thenApply functions/extract-payload-function)))

(exists? [this k set-name]
(pt/exists? this k set-name {}))
Expand Down

0 comments on commit f39896e

Please sign in to comment.