From 256e61ec76291f4864177368af663cf5d740252e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 21 Apr 2026 10:18:24 -0500 Subject: [PATCH] types: add @type t to last two untyped GenServer structs Every other defstruct in the app already has a @type t declaration; these two GenServer states were the last holdouts. Declaring t here means the whole codebase is ready for the typed-struct milestone of Elixir's set-theoretic type system (the next phase after the inference pass already shipping in 1.19). --- lib/aprsme/connection_monitor.ex | 7 +++++++ lib/aprsme_web/live/map_live/packet_batcher.ex | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/lib/aprsme/connection_monitor.ex b/lib/aprsme/connection_monitor.ex index 969bf31..52ba255 100644 --- a/lib/aprsme/connection_monitor.ex +++ b/lib/aprsme/connection_monitor.ex @@ -22,6 +22,13 @@ defmodule Aprsme.ConnectionMonitor do :last_check ] + @type t :: %__MODULE__{ + node_stats: %{optional(node()) => map()}, + local_connections: non_neg_integer(), + draining: boolean(), + last_check: integer() + } + def start_link(opts) do GenServer.start_link(__MODULE__, opts, name: __MODULE__) end diff --git a/lib/aprsme_web/live/map_live/packet_batcher.ex b/lib/aprsme_web/live/map_live/packet_batcher.ex index 131b9a3..f8aa71b 100644 --- a/lib/aprsme_web/live/map_live/packet_batcher.ex +++ b/lib/aprsme_web/live/map_live/packet_batcher.ex @@ -14,6 +14,12 @@ defmodule AprsmeWeb.MapLive.PacketBatcher do defstruct [:parent_pid, :buffer, :timer_ref] + @type t :: %__MODULE__{ + parent_pid: pid(), + buffer: [map()], + timer_ref: reference() | nil + } + @doc """ Start the packet batcher for a LiveView process. """