Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions grpc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.0.4 (2026-0-15)

### Bug Fixes

* Remove dangling typespecs

## v1.0.3 (2026-07-27)

### Enhancements
Expand Down Expand Up @@ -63,7 +69,7 @@
### Enhancements

* Feat add `exception_log_filter` option to server

### Bug fixes

* Fix ensure thers is only one `GRPC.Client.Supervisor`.
Expand All @@ -76,9 +82,9 @@
* Feat added new function to handle side-effects.
* Feat added error handler for unary and stream pipelines.
* Docs adds a better explanation of the different types of input.
* Docs improvements to module documentation.
* Docs improvements to module documentation.
* Docs livebooks added directly to the documentation.

### Bug fixes

* Fix refresh error spam on direct_state (no lb).
Expand Down
3 changes: 0 additions & 3 deletions grpc/lib/grpc/client/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ defmodule GRPC.Client.Adapter do
"""
alias GRPC.Client.Stream

@typedoc "Determines if the headers have finished being read."
@type fin :: :fin | :nofin

@callback connect(channel :: struct(), opts :: keyword()) ::
{:ok, struct()} | {:error, any()}

Expand Down
6 changes: 0 additions & 6 deletions grpc/lib/grpc/client/adapters/gun/stream_response_process.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ defmodule GRPC.Client.Adapters.Gun.StreamResponseProcess do

@terminated_stream_error {:error, {:connection_error, :closed}}

@type state :: %{
messages: :queue.queue(),
waiter: {GenServer.from(), reference() | nil} | nil,
done: boolean()
}

def start_link do
GenServer.start_link(__MODULE__, [])
end
Expand Down
13 changes: 0 additions & 13 deletions grpc/lib/grpc/client/adapters/mint/connection_process/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ if Code.ensure_loaded?(Mint.HTTP) do
retry_attempt: 0
]

@type t :: %__MODULE__{
conn: Mint.HTTP.t(),
requests: map(),
parent: pid(),
scheme: Mint.Types.scheme() | nil,
host: Mint.Types.address() | nil,
port: :inet.port_number() | nil,
connect_opts: keyword(),
retry_timeout_ms: non_neg_integer() | nil,
retry: non_neg_integer(),
retry_attempt: non_neg_integer()
}

def new(conn, opts) do
%__MODULE__{
conn: conn,
Expand Down
16 changes: 0 additions & 16 deletions grpc/lib/grpc/client/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,6 @@ defmodule GRPC.Client.Connection do
@await_ready_start_event [:grpc, :client, :connection, :await_ready, :start]
@await_ready_stop_event [:grpc, :client, :connection, :await_ready, :stop]

@type t :: %__MODULE__{
virtual_channel: struct(),
real_channels: %{String.t() => {:connected, struct()} | {:failed, any()}},
lb_mod: module() | nil,
lb_state: term() | nil,
resolver: module() | nil,
adapter: module(),
resolver_target: String.t() | nil,
connect_opts: keyword(),
resolver_state: term() | nil,
established?: boolean(),
last_error: term() | nil,
retry_attempt: non_neg_integer(),
waiters: [{pid(), GenServer.from(), reference(), integer()}]
}

defstruct virtual_channel: nil,
real_channels: %{},
lb_mod: nil,
Expand Down
26 changes: 14 additions & 12 deletions grpc/lib/grpc/client/interceptor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ defmodule GRPC.ClientInterceptor do

alias GRPC.Client.Stream

@type options :: any()
@type req :: struct() | nil
@type next :: (Stream.t(), req -> GRPC.Stub.rpc_return())

@callback init(options) :: options
@callback call(stream :: Stream.t(), req, next, options) :: GRPC.Stub.rpc_return()
@callback init(options :: any()) :: options :: any()
@callback call(
stream :: Stream.t(),
req :: struct() | nil,
next :: (Stream.t(), req :: struct() | nil -> GRPC.Stub.rpc_return()),
options :: any()
) :: GRPC.Stub.rpc_return()
end

defmodule GRPC.Client.Interceptor do
Expand All @@ -21,10 +22,11 @@ defmodule GRPC.Client.Interceptor do
"""
alias GRPC.Client.Stream

@type options :: any()
@type req :: struct() | nil
@type next :: (Stream.t(), req -> GRPC.Stub.rpc_return())

@callback init(options) :: options
@callback call(stream :: Stream.t(), req, next, options) :: GRPC.Stub.rpc_return()
@callback init(options :: any()) :: options :: any()
@callback call(
stream :: Stream.t(),
req :: struct() | nil,
next :: (Stream.t(), req :: struct() | nil -> GRPC.Stub.rpc_return()),
options :: any()
) :: GRPC.Stub.rpc_return()
end
15 changes: 7 additions & 8 deletions grpc/lib/grpc/client/resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,18 @@ defmodule GRPC.Client.Resolver do
alias GRPC.Client.Resolver.Unix
alias GRPC.Client.Resolver.XDS

@type service_config :: GRPC.Client.ServiceConfig.t() | nil

@callback resolve(String.t()) ::
{:ok, %{addresses: list(map()), service_config: service_config()}}
@callback resolve(target :: String.t()) ::
{:ok,
%{addresses: list(map()), service_config: GRPC.Client.ServiceConfig.t() | nil}}
| {:error, term()}

@callback init(target :: String.t(), opts :: keyword()) ::
{:ok, state :: term()} | {:error, term()}
{:ok, state :: any()} | {:error, term()}

@callback update(state :: term(), event :: term()) ::
{:ok, state :: term()}
@callback update(state :: any(), event :: any()) ::
{:ok, state :: any()}

@callback shutdown(state :: term()) :: :ok
@callback shutdown(state :: any()) :: :ok

@optional_callbacks [init: 2, update: 2, shutdown: 1]

Expand Down
6 changes: 0 additions & 6 deletions grpc/lib/grpc/client/service_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ defmodule GRPC.Client.ServiceConfig do
method_configs: [],
raw: %{}

@type t :: %__MODULE__{
load_balancing_policy: atom(),
method_configs: list(),
raw: map()
}

def parse(nil), do: {:ok, %__MODULE__{}}

def parse(json) when is_binary(json) do
Expand Down
20 changes: 0 additions & 20 deletions grpc/lib/grpc/client/stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ defmodule GRPC.Client.Stream do
* `:res_stream` - indicates if reply is streaming
"""

@typep stream_payload :: any()
@type t :: %__MODULE__{
channel: struct(),
service_name: String.t(),
method_name: String.t(),
grpc_type: atom(),
rpc: tuple(),
payload: stream_payload,
path: String.t(),
request_mod: atom(),
response_mod: atom(),
codec: atom(),
server_stream: boolean(),
canceled: boolean(),
compressor: module(),
accepted_compressors: [module()],
headers: map(),
__interface__: map()
}

defstruct channel: nil,
service_name: nil,
method_name: nil,
Expand Down
11 changes: 0 additions & 11 deletions grpc/lib/grpc/stub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ defmodule GRPC.Stub do

@canceled_error GRPC.RPCError.exception(GRPC.Status.cancelled(), "The operation was cancelled")

@type receive_data_return ::
{:ok, struct()}
| {:ok, struct(), map()}
| {:ok, Enumerable.t()}
| {:ok, Enumerable.t(), map()}

@type rpc_return ::
GRPC.Client.Stream.t()
| {:error, GRPC.RPCError.t()}
| receive_data_return

defmacro __using__(opts) do
opts = Keyword.validate!(opts, [:service, warn_on_collision: true])

Expand Down
6 changes: 3 additions & 3 deletions grpc/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule GRPC.MixProject do
use Mix.Project

@source_url "https://github.com/elixir-grpc/grpc/tree/master/grpc"
@version "1.0.3"
@version "1.0.4"

def project do
[
Expand All @@ -29,8 +29,8 @@ defmodule GRPC.MixProject do

defp deps do
[
# {:grpc_core, path: "../grpc_core"},
{:grpc_core, "~> 1.0.3"},
{:grpc_core, path: "../grpc_core"},
# {:grpc_core, "~> 1.0.3"},
{:gun, "~> 2.4.0", optional: true},
{:mint, "~> 1.9", optional: true},
{:castore, "~> 1.0", optional: true},
Expand Down
1 change: 0 additions & 1 deletion grpc_core/lib/grpc/credential.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ defmodule GRPC.Credential do
iex> GRPC.Stub.connect("localhost:10000", cred: cred)
"""

@type t :: %__MODULE__{ssl: [:ssl.tls_option()]}
defstruct ssl: []

@doc """
Expand Down
6 changes: 0 additions & 6 deletions grpc_core/lib/grpc/rpc_error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ defmodule GRPC.RPCError do

defguard is_rpc_error(e, status) when is_struct(e, __MODULE__) and e.status == status

@type t :: %__MODULE__{
status: GRPC.Status.t(),
message: String.t(),
details: [Google.Protobuf.Any.t()] | nil
}

alias GRPC.Status

def new(status) when is_atom(status) do
Expand Down
2 changes: 0 additions & 2 deletions grpc_core/lib/grpc/status.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ defmodule GRPC.Status do
For more details, please refer to the [official gRPC docs](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
"""

@type t :: non_neg_integer

@doc """
Not an error; returned on success.
"""
Expand Down
2 changes: 1 addition & 1 deletion grpc_core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule GRPC.Core.MixProject do
use Mix.Project

@source_url "https://github.com/elixir-grpc/grpc_core"
@version "1.0.3"
@version "1.0.4"

def project do
[
Expand Down
12 changes: 9 additions & 3 deletions grpc_server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.0.4 (2026-0-15)

### Bug Fixes

* Remove dangling typespecs

## v1.0.0 (2026-06-15)

### Enhancements
Expand Down Expand Up @@ -43,7 +49,7 @@
### Enhancements

* Feat add `exception_log_filter` option to server

### Bug fixes

* Fix ensure thers is only one `GRPC.Client.Supervisor`.
Expand All @@ -56,9 +62,9 @@
* Feat added new function to handle side-effects.
* Feat added error handler for unary and stream pipelines.
* Docs adds a better explanation of the different types of input.
* Docs improvements to module documentation.
* Docs improvements to module documentation.
* Docs livebooks added directly to the documentation.

### Bug fixes

* Fix refresh error spam on direct_state (no lb).
Expand Down
4 changes: 0 additions & 4 deletions grpc_server/lib/grpc/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ defmodule GRPC.Server do
alias GRPC.Server.Router
alias GRPC.Server.Transcode

@type rpc_req :: struct | Enumerable.t()
@type rpc_return :: struct | any
@type rpc :: (GRPC.Server.rpc_req(), GRPC.Server.Stream.t() -> rpc_return)

defmacro __using__(opts) do
quote bind_quoted: [opts: opts], location: :keep do
opts =
Expand Down
12 changes: 2 additions & 10 deletions grpc_server/lib/grpc/server/adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ defmodule GRPC.Server.Adapter do
HTTP server adapter for GRPC.
"""

@type state :: %{
pid: pid,
handling_timer: reference | nil,
resp_trailers: map,
compressor: atom | nil,
pending_reader: nil
}

@callback start(
atom(),
%{String.t() => [module()]},
Expand All @@ -21,7 +13,7 @@ defmodule GRPC.Server.Adapter do

@callback stop(atom(), %{String.t() => [module()]}) :: :ok | {:error, :not_found}

@callback send_reply(state, content :: binary(), opts :: keyword()) :: any()
@callback send_reply(state :: map(), content :: binary(), opts :: keyword()) :: any()

@callback send_headers(state, headers :: map()) :: any()
@callback send_headers(state :: map(), headers :: map()) :: any()
end
30 changes: 0 additions & 30 deletions grpc_server/lib/grpc/server/adapters/cowboy/handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,6 @@ defmodule GRPC.Server.Adapters.Cowboy.Handler do
# Override per-server with the :max_body_size option (bytes).
@default_max_body_size 4 * 1024 * 1024

@type init_state :: {
endpoint :: atom(),
server :: {name :: String.t(), module()},
route :: String.t(),
opts :: keyword()
}

@type pending_reader :: {
cowboy_read_ref :: reference,
server_rpc_pid :: pid,
server_rpc_reader_reference :: reference
}
@type stream_state :: %{
pid: server_rpc_pid :: pid,
handling_timer: timeout_timer_ref :: reference,
pending_reader: nil | pending_reader,
access_mode: GRPC.Server.Stream.access_mode(),
exception_log_filter: exception_log_filter()
}
@type init_result ::
{:cowboy_loop, :cowboy_req.req(), stream_state} | {:ok, :cowboy_req.req(), init_state}

@type is_fin :: :fin | :nofin

@type stream_body_opts :: {:code, module()} | {:compress, boolean()}

@type headers :: %{binary() => binary()}

@type exception_log_filter :: {module(), atom()} | nil

@doc """
This function is meant to be called whenever a new request arrives to an existing connection.
This handler works mainly with two linked processes.
Expand Down
Loading
Loading