Skip to content

Commit 7b93f51

Browse files
committed
chore(cljfmt) format buffers
1 parent 7d078e7 commit 7b93f51

File tree

5 files changed

+4
-24
lines changed

5 files changed

+4
-24
lines changed

project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
[org.clojure/core.async "0.5.527"]
2222
[spootnik/unilog "0.7.30"]]
2323
:source-paths ["dev"]}}
24-
:repl-options {:init-ns user})
24+
:repl-options {:init-ns user})

src/felice/admin.clj

-16
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
{:metadata (.metadata offset-metadata)
2929
:offset (.offset offset-metadata)})
3030

31-
3231
(defn admin-client
3332
"Instanciate an `Admin` from properties"
3433
{:added "3.2.0-1.7"}
@@ -38,7 +37,6 @@
3837
(dissoc :key.deserializer :value.deserializer :topics))]
3938
(Admin/create ^java.util.Map props*))))
4039

41-
4240
(defn admin-close
4341
"Close the Admin client and release all associated resources.
4442
@@ -52,7 +50,6 @@
5250
([^Admin ac]
5351
(.close ac)))
5452

55-
5653
(defn admin-metrics
5754
"Get the metrics kept by the adminClient"
5855
{:added "3.2.0-1.7"}
@@ -67,7 +64,6 @@
6764
:tags (.tags name)
6865
:value (.metricValue o)}))))))
6966

70-
7167
(defn describe-cluster
7268
"Get information about the nodes in the cluster,
7369
using the default options."
@@ -81,7 +77,6 @@
8177
:controller-node (->node (deref (.controller desc)))
8278
:nodes (map ->node (deref (.nodes desc)))})))
8379

84-
8580
(defn list-topics
8681
"List topics for the current `Admin` connection"
8782
{:added "3.2.0-1.7"}
@@ -90,7 +85,6 @@
9085
(.names)
9186
deref)))
9287

93-
9488
(defn- safely-resolve-field [class f]
9589
(try (.get (.getField class f) nil) (catch Exception _ nil)))
9690
(defn- static-field->props
@@ -109,7 +103,6 @@
109103
(sorted-map)
110104
m))
111105

112-
113106
(defn- mk-topic-instance
114107
^NewTopic
115108
[^String topic-name partition-count replication-factor props]
@@ -188,14 +181,12 @@
188181
:status :kafka.topic/error})))))
189182
(throw (ex-info "Bad Topics spec" (s/explain-data (s/coll-of :kafka.topic/name) topics))))))
190183

191-
192184
(defn delete-topic
193185
"Delete a topic"
194186
{:added "3.2.0-1.7"}
195187
([^Admin ac topic-name]
196188
(first (delete-topics ac #{topic-name}))))
197189

198-
199190
(defn describe-topics
200191
"Describe some topics in the cluster.
201192
@@ -214,14 +205,12 @@
214205
:partitions (map ->topic-partition (.partitions o))}))
215206
(sorted-map))))))
216207

217-
218208
(defn describe-topic
219209
"Describe a topic."
220210
{:added "3.2.0-1.7"}
221211
([^Admin ac topic]
222212
(first (describe-topic ac #{topic}))))
223213

224-
225214
(defn list-consumer-groups
226215
"List the consumer groups for the current `Admin`
227216
connection"
@@ -235,7 +224,6 @@
235224
:is-simple-consumer-group (.isSimpleConsumerGroup o)
236225
:state (keyword (.orElse (.state o) "unknown"))})))))
237226

238-
239227
(defn list-consumer-groups-offsets
240228
"List consumer group offsets, if no group id specified,
241229
compute for all the group-id well-known in the current
@@ -263,7 +251,6 @@
263251
[t (map #(dissoc % :topic-name) v)])
264252
per-topic-offsets))}))))
265253

266-
267254
(defn sum-consumer-groups-offsets
268255
"Sum consumer group offset over all partitions"
269256
{:added "3.2.0-1.7"}
@@ -280,7 +267,6 @@
280267
:sum (apply + (map #(get-in % [:metadata :offset])
281268
offsets))})))}))))
282269

283-
284270
(defn set-consumer-group-topic-offset
285271
"Alters offsets for the specified group of a specific topic.
286272
@@ -310,7 +296,6 @@
310296
second)}
311297
(recur op)))))))
312298

313-
314299
(defn delete-consumer-groups
315300
"Delete consumer groups from the cluster with the default options."
316301
{:added "3.2.0-1.7"}
@@ -327,7 +312,6 @@
327312
:status :kafka.consumer-group/error
328313
:message (.getMessage e)})))))))
329314

330-
331315
(defn delete-consumer-group
332316
"Delete one consumer group from the cluster
333317
with the default options."

src/felice/consumer.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
(defn metrics
7171
"returns a list of mtrics mapkept by the consumer"
72-
{:added "3.2.0-1.7"}
72+
{:added "3.2.0-1.7"}
7373
[^KafkaConsumer consumer]
7474
(map (fn [^java.util.Map$Entry m] (metric->map (.getValue m))) (.metrics consumer)))
7575

test/felice/admin_test.clj

+2-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
(is (= #{:cluster-id :authorized-operation :controller-node :nodes} (set (keys (admin/describe-cluster admin-client)))))
3737
(admin/admin-close admin-client))))
3838

39-
4039
(deftest consumer-state-tests
4140
(testing "consumer state tests"
4241
(let [group-id "test-1"
@@ -75,7 +74,7 @@
7574

7675
;;Reset all the offset to beginning
7776
(is (= [0]
78-
(map #(get-in %[:metadata :offset]) (:offsets (admin/set-consumer-group-topic-offset admin-client group-id topic 0)))))
77+
(map #(get-in % [:metadata :offset]) (:offsets (admin/set-consumer-group-topic-offset admin-client group-id topic 0)))))
7978

8079
(def consumer-2 (consumer/consumer {:bootstrap.servers "localhost:9092"
8180
:group.id group-id
@@ -84,9 +83,7 @@
8483

8584
(consumer/subscribe consumer-2 topic)
8685

87-
88-
89-
;; Let's replay test then
86+
;; Let's replay test then
9087
(let [consumer-records (consumer/poll consumer-2 100000)
9188
records (consumer/poll->all-records consumer-records)]
9289
(is (not (.isEmpty consumer-records)) "we have polled something")

test/felice/core_test.clj

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
(ul/start-logging! (-> ul/default-configuration
1414
(assoc :overrides {"org.apache" :warn})))
1515

16-
1716
(deftest client
1817
(testing "produce and consume strings"
1918
(let [admin-client (admin/admin-client {:bootstrap.servers "localhost:9092"})

0 commit comments

Comments
 (0)