da5bbf0

Branches > client-handling-rewrite > da5bbf0 > files

Reorganize specs in client message ns

Grahp, 2026-06-02

Commit: da5bbf05e0832d59b43bfab142fbbd083fcc95ad
Parent: c3b3aa9

1 changed file:

src/net/bowmap/network/message/client.clj modified (view file)

@@ -20,12 +20,6 @@   (:import    [io.netty.buffer ByteBuf Unpooled])) -(S/def ::registry (s/map-of ::state/connection-state (s/coll-of ::msg/id :type vector?)))-(S/def ::message->packet-ids (s/map-of (s/schema [::state/connection-state ::msg/id]) ::pk/id))-(S/def ::packets-  (s/map-of ::msg/id (s/fspec :args (s/cat :buf #(instance? ByteBuf %) :pk ::msg/message)-                              :ret #(instance? ByteBuf %))))- (defn build-packet-ids [registry]   (build [[state packet-ids] registry           [i id] (map-indexed vector packet-ids)]@@ -34,7 +28,7 @@      i]))  (s/fdef build-packet-ids-        :args (s/cat :registry ::registry)+        :args (s/cat :registry (s/map-of ::state/connection-state (s/coll-of ::msg/id :type vector?)))         :ret ::message->packet-ids)  (defn build-packets [registry]@@ -46,9 +40,8 @@         :args (s/cat (s/map-of ::msg/id ::t/table))         :ret ::packets) -; TODO docstring?-(def ^{:spec ::message->packet-ids}-  message->packet-ids+(S/def ::message->packet-ids (s/map-of (s/schema [::state/connection-state ::msg/id]) ::pk/id))+(def message->packet-ids   ; Packet ids could map directly to numeric-ids and be stateless,   ; but some packets have duplicates across connection states that you'd want to handle in the same way.   ; If it turns out that I don't end up handling packets in this way, then packet ids could map directly to numeric ids.@@ -226,8 +219,10 @@       ::clear-dialog       ::show-dialog-play]})) -(def ^{:spec ::packets}-  packets+(S/def ::packets+  (s/map-of ::msg/id (s/fspec :args (s/cat :buf #(instance? ByteBuf %) :pk ::msg/message)+                              :ret #(instance? ByteBuf %))))+(def packets   (build-packets     {::status-response [:response "Response to serverbound ::status-request" json->]      ::pong-response [:timestamp "The same timestamp as serverbound ::ping-request" long->]