2021-06-09 22:24:02 +08:00
|
|
|
defmodule Livebook.Runtime.NoopRuntime do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
# A runtime that doesn't do any actual evaluation,
|
|
|
|
# thus not requiring any underlying resources.
|
|
|
|
|
2022-04-02 02:13:37 +08:00
|
|
|
defstruct [:started]
|
2021-06-09 22:24:02 +08:00
|
|
|
|
2022-04-02 02:13:37 +08:00
|
|
|
def new() do
|
|
|
|
%__MODULE__{started: false}
|
|
|
|
end
|
2021-06-09 22:24:02 +08:00
|
|
|
|
|
|
|
defimpl Livebook.Runtime do
|
2022-04-02 02:13:37 +08:00
|
|
|
def describe(_runtime) do
|
|
|
|
[{"Type", "Noop"}]
|
|
|
|
end
|
|
|
|
|
|
|
|
def connect(runtime), do: {:ok, %{runtime | started: true}}
|
|
|
|
def connected?(runtime), do: runtime.started
|
|
|
|
def take_ownership(_, _), do: make_ref()
|
|
|
|
def disconnect(runtime), do: {:ok, %{runtime | started: false}}
|
|
|
|
def duplicate(_), do: Livebook.Runtime.NoopRuntime.new()
|
|
|
|
|
2021-07-16 00:19:36 +08:00
|
|
|
def evaluate_code(_, _, _, _, _ \\ []), do: :ok
|
|
|
|
def forget_evaluation(_, _), do: :ok
|
2021-06-09 22:24:02 +08:00
|
|
|
def drop_container(_, _), do: :ok
|
2021-07-21 03:30:53 +08:00
|
|
|
def handle_intellisense(_, _, _, _, _), do: :ok
|
2022-02-28 20:53:33 +08:00
|
|
|
|
2022-04-02 02:13:37 +08:00
|
|
|
def standalone?(_), do: false
|
|
|
|
def read_file(_, _), do: raise("not implemented")
|
2022-03-05 20:19:42 +08:00
|
|
|
def start_smart_cell(_, _, _, _, _), do: :ok
|
|
|
|
def set_smart_cell_base_locator(_, _, _), do: :ok
|
2022-02-28 20:53:33 +08:00
|
|
|
def stop_smart_cell(_, _), do: :ok
|
2022-04-02 02:13:37 +08:00
|
|
|
|
|
|
|
def fixed_dependencies?(_), do: false
|
|
|
|
|
|
|
|
def add_dependencies(_runtime, code, dependencies) do
|
|
|
|
Livebook.Runtime.Dependencies.add_mix_deps(code, dependencies)
|
|
|
|
end
|
|
|
|
|
|
|
|
def search_dependencies(_, _, _), do: make_ref()
|
2021-06-09 22:24:02 +08:00
|
|
|
end
|
|
|
|
end
|