AshScylla.Repo behaviour (AshScylla v0.10.2)

Copy Markdown View Source

Configuration module for AshScylla using direct Xandra connections.

Usage

defmodule MyApp.Repo do
  use AshScylla.Repo,
    otp_app: :my_app
end

Then configure it in config/config.exs:

config :my_app, MyApp.Repo,
  nodes: ["127.0.0.1:9042"],
  keyspace: "my_app_dev"

Adding to your supervision tree

children = [
  MyApp.Repo,
  # ...
]

Options

  • :nodes - List of ScyllaDB/Cassandra nodes to connect to
  • :keyspace - The keyspace to use
  • :connect_timeout - TCP connection timeout in ms (default: 5000)
  • :disable_lwt? - Disable lightweight transactions even when resource config enables them (default: false)
  • :disable_atomic_actions? - Disable atomic action support (default: false)
  • :installed_extensions - List of installed ScyllaDB extensions (e.g. [:lwt])

Summary

Functions

Converts repo config to Xandra connection options.

Types

config()

@type config() :: keyword()

Callbacks

child_spec(keyword)

@callback child_spec(keyword()) :: Supervisor.child_spec()

config()

@callback config() :: keyword()

connection()

@callback connection() :: AshScylla.Connection.t() | nil

create_keyspace(arg1, keyword)

@callback create_keyspace(
  String.t() | nil,
  keyword()
) :: {:ok, term()} | {:error, term()}

disable_atomic_actions?()

@callback disable_atomic_actions?() :: boolean()

disable_lwt?()

@callback disable_lwt?() :: boolean()

drop_keyspace(arg1)

@callback drop_keyspace(String.t() | nil) :: {:ok, term()} | {:error, term()}

installed_extensions()

@callback installed_extensions() :: [atom()]

keyspace()

@callback keyspace() :: String.t() | nil

nodes()

@callback nodes() :: [String.t()]

prepare(t, keyword)

@callback prepare(
  String.t(),
  keyword()
) :: {:ok, Xandra.Prepared.t()} | {:error, term()}

prepare!(t, keyword)

@callback prepare!(
  String.t(),
  keyword()
) :: Xandra.Prepared.t() | no_return()

query(t, list, keyword)

@callback query(String.t(), list(), keyword()) :: {:ok, term()} | {:error, term()}

query!(t, list, keyword)

@callback query!(String.t(), list(), keyword()) :: term() | no_return()

Functions

config_to_conn_opts(repo_module)

@spec config_to_conn_opts(module()) :: keyword()

Converts repo config to Xandra connection options.