Packages
livebook
0.15.3
0.19.8
0.19.7
0.19.6
0.19.5
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.6
0.18.5
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.3
0.17.2
0.17.1
0.17.0
0.16.4
0.16.3
0.16.2
0.16.1
0.16.0
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.7
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.14.0-rc.1
0.14.0-rc.0
0.13.3
0.13.2
0.13.1
0.13.0
0.12.1
0.12.0
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.0
0.9.3
0.9.2
0.9.1
0.9.0
0.8.2
0.8.1
0.8.0
0.7.2
0.7.1
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.2
0.1.1
0.1.0
Automate code & data workflows with interactive notebooks
Current section
Files
Jump to
Current section
Files
lib/livebook/hubs/provider.ex
defprotocol Livebook.Hubs.Provider do
alias Livebook.FileSystem
alias Livebook.Secrets.Secret
@typedoc """
An provider-specific map stored as notebook stamp.
Notebook stamp is meant to serve two purposes:
1. Signing notebook source to ensure notebook integrity and
authenticity.
2. Storing sensitive notebook metadata in encrypted form, so that
it cannot be read nor modified outside of Livebook.
Those can be achieved using arbitrary cryptography mechanics. The
stamp itself is an opaque map, however it must be JSON-compatible
and use string keys.
"""
@type notebook_stamp :: map()
@type field_errors :: list({atom(), list(String.t())})
@doc """
Transforms given hub to `Livebook.Hubs.Metadata` struct.
"""
@spec to_metadata(t()) :: Livebook.Hubs.Metadata.t()
def to_metadata(hub)
@doc """
Loads fields into given hub.
"""
@spec load(t(), map() | keyword()) :: struct()
def load(hub, fields)
@doc """
Gets the type from hub.
"""
@spec type(t()) :: String.t()
def type(hub)
@doc """
Gets the child spec of the given hub.
"""
@spec connection_spec(t()) :: Supervisor.child_spec() | module() | {module(), any()} | nil
def connection_spec(hub)
@doc """
Disconnects the given hub.
"""
@spec disconnect(t()) :: :ok
def disconnect(hub)
@doc """
Gets the secrets of the given hub.
"""
@spec get_secrets(t()) :: list(Secret.t())
def get_secrets(hub)
@doc """
Creates a secret of the given hub.
"""
@spec create_secret(t(), Secret.t()) ::
:ok
| {:error, field_errors()}
| {:transport_error, String.t()}
def create_secret(hub, secret)
@doc """
Updates a secret of the given hub.
"""
@spec update_secret(t(), Secret.t()) ::
:ok
| {:error, field_errors()}
| {:transport_error, String.t()}
def update_secret(hub, secret)
@doc """
Deletes a secret of the given hub.
"""
@spec delete_secret(t(), Secret.t()) :: :ok | {:transport_error, String.t()}
def delete_secret(hub, secret)
@doc """
Gets the connection status from hub.
"""
@spec connection_status(t()) :: String.t() | nil
def connection_status(hub)
@doc """
Generates a notebook stamp.
See `t:notebook_stamp/0` for more details.
"""
@spec notebook_stamp(t(), iodata(), map()) ::
{:ok, notebook_stamp()} | :skip | {:error, String.t()}
def notebook_stamp(hub, notebook_source, metadata)
@doc """
Verifies a notebook stamp and returns the decrypted metadata.
See `t:notebook_stamp/0` for more details.
"""
@spec verify_notebook_stamp(t(), iodata(), notebook_stamp()) ::
{:ok, metadata :: map()} | {:error, :invalid | :too_recent_version}
def verify_notebook_stamp(hub, notebook_source, stamp)
@doc """
Transforms hub to the attributes map sent to storage.
"""
@spec dump(t()) :: map()
def dump(hub)
@doc """
Gets the file systems of given hub.
"""
@spec get_file_systems(t()) :: list(FileSystem.t())
def get_file_systems(hub)
@doc """
Creates a file system of the given hub.
"""
@spec create_file_system(t(), FileSystem.t()) ::
:ok
| {:error, field_errors()}
| {:transport_error, String.t()}
def create_file_system(hub, file_system)
@doc """
Updates a file system of the given hub.
"""
@spec update_file_system(t(), FileSystem.t()) ::
:ok
| {:error, field_errors()}
| {:transport_error, String.t()}
def update_file_system(hub, file_system)
@doc """
Deletes a file system of the given hub.
"""
@spec delete_file_system(t(), FileSystem.t()) :: :ok | {:transport_error, String.t()}
def delete_file_system(hub, file_system)
@doc """
Get the deployment groups for a given hub.
Returns `nil` if deployment groups are not applicable to this hub.
"""
@spec deployment_groups(t()) ::
list(%{id: String.t(), name: String.t(), secrets: list(Secret.t())}) | nil
def deployment_groups(hub)
@doc """
Gets app specs for permanent apps sourced from the given hub.
"""
@spec get_app_specs(t()) :: list(Livebook.Apps.AppSpec.t())
def get_app_specs(hub)
end