mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-14 23:45:57 +08:00
* Define session data structure and some operations * Make code evaluation request async, so that we don't need an intermediary process * Simplify id typespecs * Make operation application composable * Keep a separate evaluation queue per section and actually support concurrent evaluation * Small fixes * Validate queued cell type and set evaluation timestamp * Apply review suggestions * Add tests * Store evaluating_cell_id instead of section status * Add dynamic supervisor for managing evaluator processes * Some fixes * Refactor operation application * Upon cell deletion mark dependent cells as stale
35 lines
742 B
Elixir
35 lines
742 B
Elixir
defmodule LiveBook.Notebook.Section do
|
|
@moduledoc """
|
|
Data structure representing a single section in a notebook.
|
|
|
|
Each section contains a number of cells and is isolated
|
|
in the sense that cells don't interfere with cells in other sections.
|
|
"""
|
|
|
|
defstruct [:id, :name, :cells, :metadata]
|
|
|
|
alias LiveBook.Notebook.Cell
|
|
alias LiveBook.Utils
|
|
|
|
@type id :: Utils.id()
|
|
|
|
@type t :: %__MODULE__{
|
|
id: id(),
|
|
name: String.t(),
|
|
cells: list(Cell.t()),
|
|
metadata: %{atom() => term()}
|
|
}
|
|
|
|
@doc """
|
|
Returns a blank section.
|
|
"""
|
|
@spec new() :: t()
|
|
def new() do
|
|
%__MODULE__{
|
|
id: Utils.random_id(),
|
|
name: "Section",
|
|
cells: [],
|
|
metadata: %{}
|
|
}
|
|
end
|
|
end
|