From f39896ec1269f5e336bf134d3fa12bf648420b86 Mon Sep 17 00:00:00 2001 From: Yevgeni Tsodikov Date: Tue, 8 Aug 2023 12:52:31 +0300 Subject: [PATCH] Fix linter warnings --- src/main/clojure/aerospike_clj/client.clj | 28 +++++++++---------- src/main/clojure/aerospike_clj/functions.clj | 10 +++---- .../clojure/aerospike_clj/mock_client.clj | 7 ++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/main/clojure/aerospike_clj/client.clj b/src/main/clojure/aerospike_clj/client.clj index 3b2eaaf..53d3d66 100644 --- a/src/main/clojure/aerospike_clj/client.clj +++ b/src/main/clojure/aerospike_clj/client.clj @@ -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 {})) @@ -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 {})) @@ -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 {})) @@ -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] @@ -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] @@ -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 {})) @@ -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] @@ -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] @@ -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 @@ -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] @@ -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))) @@ -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)))) diff --git a/src/main/clojure/aerospike_clj/functions.clj b/src/main/clojure/aerospike_clj/functions.clj index e4fe913..176b126 100644 --- a/src/main/clojure/aerospike_clj/functions.clj +++ b/src/main/clojure/aerospike_clj/functions.clj @@ -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)))) diff --git a/src/main/clojure/aerospike_clj/mock_client.clj b/src/main/clojure/aerospike_clj/mock_client.clj index 82157f1..a02f89f 100644 --- a/src/main/clojure/aerospike_clj/mock_client.clj +++ b/src/main/clojure/aerospike_clj/mock_client.clj @@ -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)) @@ -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 {}))