]> Entropealabs - wampex_router.git/commitdiff
more specs to the roles
authorChristopher <chris@entropealabs.com>
Tue, 18 Feb 2020 02:31:52 +0000 (20:31 -0600)
committerChristopher <chris@entropealabs.com>
Tue, 18 Feb 2020 02:31:52 +0000 (20:31 -0600)
lib/wampex/roles/callee.ex
lib/wampex/roles/caller.ex
lib/wampex/roles/peer.ex
lib/wampex/roles/publisher.ex
lib/wampex/roles/subscriber.ex
mix.exs
mix.lock

index bb4ee5ee57b2fbd908dcbccfa88f25f2c89b3c60..2152e144625e81bf7b427749676cde94403a2e5a 100644 (file)
@@ -18,22 +18,27 @@ defmodule Wampex.Role.Callee do
     Map.put(roles, :callee, %{})
   end
 
+  @spec register(binary()) :: Wampex.message()
   def register(procedure) do
     [@register, %{}, procedure]
   end
 
+  @spec unregister(integer()) :: Wampex.message()
   def unregister(id) do
     [@unregister, id]
   end
 
+  @spec yield(integer()) :: Wampex.message()
   def yield(request_id) do
     [@yield, request_id, %{}]
   end
 
+  @spec yield(integer(), nonempty_list(any())) :: Wampex.message()
   def yield(request_id, arg_l) do
     [@yield, request_id, %{}, arg_l]
   end
 
+  @spec yield(integer(), nonempty_list(any()), map()) :: Wampex.message()
   def yield(request_id, arg_l, arg_kw) do
     [@yield, request_id, %{}, arg_l, arg_kw]
   end
index e9ab1d6e9f2584551933c37a0cd5c8216b2b8260..e8d65cc5496d015f6a9ee59aa0719c3af36076e9 100644 (file)
@@ -14,14 +14,17 @@ defmodule Wampex.Role.Caller do
     Map.put(roles, :caller, %{})
   end
 
+  @spec call(binary()) :: Wampex.message()
   def call(procedure) do
     [@call, %{}, procedure]
   end
 
+  @spec call(binary(), nonempty_list(any())) :: Wampex.message()
   def call(procedure, arg_l) do
     [@call, %{}, procedure, arg_l]
   end
 
+  @spec call(binary(), nonempty_list(any()), map()) :: Wampex.message()
   def call(procedure, arg_l, arg_kw) do
     [@call, %{}, procedure, arg_l, arg_kw]
   end
index a2109bc50d4d8b0450247b0a5b436c221199ee06..9622fbdcbd2694b4b23f45b31050a6d1428c94e2 100644 (file)
@@ -17,10 +17,12 @@ defmodule Wampex.Role.Peer do
   @impl true
   def add(roles), do: roles
 
+  @spec hello(binary(), nonempty_list(module())) :: Wampex.message()
   def hello(realm, roles) do
     [@hello, realm, %{roles: Enum.reduce(roles, %{}, fn r, acc -> r.add(acc) end)}]
   end
 
+  @spec goodbye(binary()) :: Wampex.message()
   def goodbye(reason) do
     [@goodbye, %{}, reason]
   end
index 69ada8c11b58adf338854b4d220609f0bc8d90d0..614a0a1648f4790209dcb81b14d6617b894da0c6 100644 (file)
@@ -14,14 +14,17 @@ defmodule Wampex.Role.Publisher do
     Map.put(roles, :publisher, %{})
   end
 
+  @spec publish(binary()) :: Wampex.message()
   def publish(topic) do
     [@publish, %{}, topic]
   end
 
+  @spec publish(binary(), nonempty_list(any())) :: Wampex.message()
   def publish(topic, arg_l) do
     [@publish, %{}, topic, arg_l]
   end
 
+  @spec publish(binary(), nonempty_list(any()), map()) :: Wampex.message()
   def publish(topic, arg_l, arg_kw) do
     [@publish, %{}, topic, arg_l, arg_kw]
   end
index c68296e135df9ea7b96756e6e56b8837914d191c..a34e02d94383cf662044424a1ba9e6d80a2dcaef 100644 (file)
@@ -17,10 +17,12 @@ defmodule Wampex.Role.Subscriber do
     Map.put(roles, :subscriber, %{})
   end
 
+  @spec subscribe(binary()) :: Wampex.message()
   def subscribe(topic) do
     [@subscribe, %{}, topic]
   end
 
+  @spec unsubscribe(integer()) :: Wampex.message()
   def unsubscribe(sub_id) do
     [@unsubscribe, sub_id]
   end
diff --git a/mix.exs b/mix.exs
index f6829119bccd2dc3f58c71b7415446f57269f61f..5b92a55d9405d727d5b3d7cded0208f5ce792290 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -35,6 +35,7 @@ defmodule Wampex.MixProject do
       {:excoveralls, "~> 0.12.2", only: [:dev, :test], runtime: false},
       {:credo, "~> 1.2", only: [:dev, :test], runtime: false},
       {:dialyxir, "~> 0.5.1", only: [:dev, :test], runtime: false},
+      {:ex_doc, "~> 0.21", only: :dev, runtime: false},
       {:jason, "~> 1.1"},
       {:msgpack, "~> 0.7.0"},
       {:states_language, "~> 0.2"},
index 2c2f523bec010c7f28187040d9f3de6b2e981555..16d1737fea749a8a9262b1e9544e2d524b342bb8 100644 (file)
--- a/mix.lock
+++ b/mix.lock
@@ -5,13 +5,17 @@
   "coveralls": {:hex, :coveralls, "2.1.0", "b44cea21202c0e1994dfced8cedbff66bcd03eeeb565484345b28afacda0559b", [:rebar3], [{:jsx, "2.10.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "bbfbe2a7bebb2d22db15a657e6c1733243e1501714d60fe14a14790d96e7c3b2"},
   "credo": {:hex, :credo, "1.2.2", "f57faf60e0a12b0ba9fd4bad07966057fde162b33496c509b95b027993494aab", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8f2623cd8c895a6f4a55ef10f3fdf6a55a9ca7bef09676bd835551687bf8a740"},
   "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm", "6c32a70ed5d452c6650916555b1f96c79af5fc4bf286997f8b15f213de786f73"},
+  "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"},
   "elixpath": {:hex, :elixpath, "0.1.0", "f860e931db7bda6856dc68145694ca429643cc068ef30d7ff6b4096d4357963e", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "30ce06079b41f1f5216ea2cd11605cfe4c82239628555cb3fde9f10055a6eb67"},
+  "ex_doc": {:hex, :ex_doc, "0.21.3", "857ec876b35a587c5d9148a2512e952e24c24345552259464b98bfbb883c7b42", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "0db1ee8d1547ab4877c5b5dffc6604ef9454e189928d5ba8967d4a58a801f161"},
   "excoveralls": {:hex, :excoveralls, "0.12.2", "a513defac45c59e310ac42fcf2b8ae96f1f85746410f30b1ff2b710a4b6cd44b", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "151c476331d49b45601ffc45f43cb3a8beb396b02a34e3777fea0ad34ae57d89"},
   "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"},
   "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"},
   "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"},
   "json_xema": {:hex, :json_xema, "0.4.0", "377446cd5c0e2cbba52b9d7ab67c05579e6d4a788335220215a8870eac821996", [:mix], [{:conv_case, "~> 0.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:xema, "~> 0.11", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "452724a5b2751cd69191edd3fd3da0c2194c164ebd49efd85f9abb64d6621b53"},
   "jsx": {:hex, :jsx, "2.10.0", "77760560d6ac2b8c51fd4c980e9e19b784016aa70be354ce746472c33beb0b1c", [:rebar3], [], "hexpm", "9a83e3704807298016968db506f9fad0f027de37546eb838b3ae1064c3a0ad62"},
+  "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"},
+  "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"},
   "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
   "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
   "msgpack": {:hex, :msgpack, "0.7.0", "128ae0a2227c7e7a2847c0f0f73551c268464f8c1ee96bffb920bc0a5712b295", [:rebar3], [], "hexpm", "4649353da003e6f438d105e4b1e0f17757f6f5ec8687a6f30875ff3ac4ce2a51"},