mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-07 20:16:31 +08:00
Group IOProxy arguments
This commit is contained in:
parent
f363be949e
commit
26d39772e8
2 changed files with 36 additions and 61 deletions
|
@ -276,16 +276,16 @@ defmodule Livebook.Runtime.Evaluator do
|
||||||
io_proxy_registry = Keyword.get(opts, :io_proxy_registry)
|
io_proxy_registry = Keyword.get(opts, :io_proxy_registry)
|
||||||
|
|
||||||
{:ok, io_proxy} =
|
{:ok, io_proxy} =
|
||||||
Evaluator.IOProxy.start(
|
Evaluator.IOProxy.start(%{
|
||||||
self(),
|
evaluator: self(),
|
||||||
send_to,
|
send_to: send_to,
|
||||||
runtime_broadcast_to,
|
runtime_broadcast_to: runtime_broadcast_to,
|
||||||
object_tracker,
|
object_tracker: object_tracker,
|
||||||
client_tracker,
|
client_tracker: client_tracker,
|
||||||
ebin_path,
|
ebin_path: ebin_path,
|
||||||
tmp_dir,
|
tmp_dir: tmp_dir,
|
||||||
io_proxy_registry
|
registry: io_proxy_registry
|
||||||
)
|
})
|
||||||
|
|
||||||
io_proxy_monitor = Process.monitor(io_proxy)
|
io_proxy_monitor = Process.monitor(io_proxy)
|
||||||
|
|
||||||
|
|
|
@ -24,58 +24,25 @@ defmodule Livebook.Runtime.Evaluator.IOProxy do
|
||||||
For all supported requests a message is sent to the configured
|
For all supported requests a message is sent to the configured
|
||||||
`:send_to` process, so this device serves as a proxy.
|
`:send_to` process, so this device serves as a proxy.
|
||||||
"""
|
"""
|
||||||
@spec start(
|
@spec start(%{
|
||||||
pid(),
|
evaluator: pid(),
|
||||||
pid(),
|
send_to: pid(),
|
||||||
pid(),
|
runtime_broadcast_to: pid(),
|
||||||
pid(),
|
object_tracker: pid(),
|
||||||
pid(),
|
client_tracker: pid(),
|
||||||
String.t() | nil,
|
ebin_path: String.t() | nil,
|
||||||
String.t() | nil,
|
tmp_dir: String.t() | nil,
|
||||||
atom() | nil
|
registry: atom() | nil
|
||||||
) :: GenServer.on_start()
|
}) :: GenServer.on_start()
|
||||||
def start(
|
def start(args) do
|
||||||
evaluator,
|
GenServer.start(__MODULE__, args)
|
||||||
send_to,
|
|
||||||
runtime_broadcast_to,
|
|
||||||
object_tracker,
|
|
||||||
client_tracker,
|
|
||||||
ebin_path,
|
|
||||||
tmp_dir,
|
|
||||||
registry
|
|
||||||
) do
|
|
||||||
GenServer.start(
|
|
||||||
__MODULE__,
|
|
||||||
{evaluator, send_to, runtime_broadcast_to, object_tracker, client_tracker, ebin_path,
|
|
||||||
tmp_dir, registry}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Linking version of `start/4`.
|
Linking version of `start/4`.
|
||||||
"""
|
"""
|
||||||
@spec start_link(
|
def start_link(args) do
|
||||||
pid(),
|
GenServer.start_link(__MODULE__, args)
|
||||||
pid(),
|
|
||||||
pid(),
|
|
||||||
pid(),
|
|
||||||
String.t() | nil,
|
|
||||||
String.t() | nil,
|
|
||||||
atom() | nil
|
|
||||||
) :: GenServer.on_start()
|
|
||||||
def start_link(
|
|
||||||
evaluator,
|
|
||||||
send_to,
|
|
||||||
runtime_broadcast_to,
|
|
||||||
object_tracker,
|
|
||||||
ebin_path,
|
|
||||||
tmp_dir,
|
|
||||||
registry
|
|
||||||
) do
|
|
||||||
GenServer.start_link(
|
|
||||||
__MODULE__,
|
|
||||||
{evaluator, send_to, runtime_broadcast_to, object_tracker, ebin_path, tmp_dir, registry}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -105,10 +72,18 @@ defmodule Livebook.Runtime.Evaluator.IOProxy do
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def init(
|
def init(args) do
|
||||||
{evaluator, send_to, runtime_broadcast_to, object_tracker, client_tracker, ebin_path,
|
%{
|
||||||
tmp_dir, registry}
|
evaluator: evaluator,
|
||||||
) do
|
send_to: send_to,
|
||||||
|
runtime_broadcast_to: runtime_broadcast_to,
|
||||||
|
object_tracker: object_tracker,
|
||||||
|
client_tracker: client_tracker,
|
||||||
|
ebin_path: ebin_path,
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
registry: registry
|
||||||
|
} = args
|
||||||
|
|
||||||
evaluator_monitor = Process.monitor(evaluator)
|
evaluator_monitor = Process.monitor(evaluator)
|
||||||
|
|
||||||
if registry do
|
if registry do
|
||||||
|
|
Loading…
Add table
Reference in a new issue