Skip to content
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ erl_crash.dump

.elixir_ls

.elixir_tools

grpc-*.tar
14 changes: 0 additions & 14 deletions benchmark/lib/benchmark/application.ex

This file was deleted.

1 change: 0 additions & 1 deletion benchmark/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule Benchmark.MixProject do
def application do
[
extra_applications: [:logger],
mod: {Benchmark.Application, []}
]
end

Expand Down
1 change: 0 additions & 1 deletion grpc_client/guides/advanced/load_balancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ You can connect using `DNS`, `Unix Domain sockets`, and `IPv4/IPv6` for now.
### DNS

```elixir
iex> {:ok, _pid} = GRPC.Client.Supervisor.start_link()
iex> {:ok, channel} = GRPC.Stub.connect("dns://orders.prod.svc.cluster.local:50051")
iex> request = Orders.GetOrderRequest.new(id: "123")
iex> {:ok, reply} = channel |> Orders.OrderService.Stub.get_order(request)
Expand Down
18 changes: 1 addition & 17 deletions grpc_client/guides/getting_started/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,7 @@ This section demonstrates how to establish client connections and perform RPC ca

## Basic Connection and RPC

Typically, you start this client supervisor as part of your application's supervision tree:

```elixir
children = [
GRPC.Client.Supervisor
]

opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
```

You can also start it manually in scripts or test environments:
```elixir
{:ok, _pid} = GRPC.Client.Supervisor.start_link()
```

Then connect with gRPC server:
Connect with gRPC server:

```elixir
iex> {:ok, channel} = GRPC.Stub.connect("localhost:50051")
Expand Down
13 changes: 13 additions & 0 deletions grpc_client/lib/grpc/client/application.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defmodule GRPC.Client.Application do
@moduledoc false
use Application

def start(_type, _args) do
children = [
{DynamicSupervisor, [name: GRPC.Client.Supervisor]}
]

opts = [strategy: :one_for_one, name: GRPC.Supervisor]
Supervisor.start_link(children, opts)
end
end
21 changes: 0 additions & 21 deletions grpc_client/lib/grpc/client/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,6 @@ defmodule GRPC.Client.Connection do
"""
@spec connect(String.t(), keyword()) :: {:ok, Channel.t()} | {:error, any()}
def connect(target, opts \\ []) do
supervisor_pid = Process.whereis(GRPC.Client.Supervisor)

if is_nil(supervisor_pid) or !Process.alive?(supervisor_pid) do
raise """
GRPC.Client.Supervisor is not running. Please ensure it is started as part of your
application's supervision tree:
children = [
{GRPC.Client.Supervisor, []}
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
You can also start it manually in scripts or test environments:
{:ok, _pid} = DynamicSupervisor.start_link(strategy: :one_for_one, name: GRPC.Client.Supervisor)
"""
end

ref = make_ref()

case build_initial_state(target, Keyword.merge(opts, ref: ref)) do
Expand All @@ -184,7 +164,6 @@ defmodule GRPC.Client.Connection do
{:ok, ch}

{:error, {:already_started, _pid}} ->
# race: someone else started it first, ask the running process for its current channel
case pick_channel(opts) do
{:ok, %Channel{} = channel} ->
{:ok, channel}
Expand Down
63 changes: 0 additions & 63 deletions grpc_client/lib/grpc/client/supervisor.ex

This file was deleted.

1 change: 1 addition & 0 deletions grpc_client/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defmodule GrpcClient.MixProject do

def application do
[
mod: {GRPC.Client.Application, []},
extra_applications: [:logger]
]
end
Expand Down
14 changes: 0 additions & 14 deletions grpc_client/test/grpc/supervisor_test.exs

This file was deleted.

7 changes: 0 additions & 7 deletions grpc_client/test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@ Mox.defmock(GRPC.Client.Resolver.DNS.MockAdapter,
for: GRPC.Client.Resolver.DNS.Adapter
)

# Start client supervisor for integration tests
{:ok, _pid} =
DynamicSupervisor.start_link(
strategy: :one_for_one,
name: GRPC.Client.Supervisor
)

ExUnit.start(capture_log: true)
1 change: 0 additions & 1 deletion interop/lib/interop/app.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ defmodule Interop.App do

def start(_type, _args) do
children = [
GRPC.Client.Supervisor,
{GRPC.Server.Supervisor, endpoint: Interop.Endpoint, port: 10000}
]

Expand Down
Loading