mirror of
https://github.com/unclebob/more-speech.git
synced 2024-09-30 02:21:02 +00:00
::event-counter
This commit is contained in:
parent
bb291a5243
commit
f6d02b2f50
@ -3,7 +3,8 @@
|
||||
[more-speech.types.active-subscription :as subscription-type]
|
||||
[more-speech.types.profile :as profile-type]
|
||||
[more-speech.types.relay :as relay-type]
|
||||
[more-speech.types.tab :as tab-type])
|
||||
[more-speech.types.tab :as tab-type]
|
||||
[more-speech.types.event-counter :as event-counter-type])
|
||||
(:import (javax.swing JFrame)
|
||||
(javax.swing.tree DefaultMutableTreeNode)))
|
||||
|
||||
@ -74,8 +75,8 @@
|
||||
::node-map
|
||||
::orphaned-replies
|
||||
::event-history
|
||||
::event-counter-type/event-counter
|
||||
|
||||
::event-counter
|
||||
::back-count
|
||||
::send-chan
|
||||
::article-window
|
||||
|
16
src/more_speech/types/event_counter.clj
Normal file
16
src/more_speech/types/event_counter.clj
Normal file
@ -0,0 +1,16 @@
|
||||
(ns more-speech.types.event-counter
|
||||
(:require [clojure.spec.alpha :as s]))
|
||||
|
||||
(s/def ::relay-url #(re-matches #"ws+://[\w.-]+/?" %))
|
||||
(s/def ::total int?)
|
||||
(s/def ::dups int?)
|
||||
(s/def ::kinds (s/map-of int? int?))
|
||||
|
||||
;Counts incoming events and sorts them by relay and kind. Also counts dups.
|
||||
(s/def ::event-counter (s/and
|
||||
(s/keys :opt-un [::total
|
||||
::dups
|
||||
::kinds])
|
||||
(s/map-of (s/or :keyword #{:total :dups :kinds}
|
||||
:url ::relay-url)
|
||||
some?)))
|
Loading…
Reference in New Issue
Block a user