View Source Lexical.Document.Store (lexical_shared v0.5.0)

Backing store for source file documents.

Link to this section Summary

Link to this section Types

@type derivation() :: {derivation_key(), derivation_fun()}
@type derivation_fun() :: (Lexical.Document.t() -> derived_value())
@type derivation_key() :: atom()
@type derivations() :: [derivation()]
@type derived_value() :: any()
@type start_opt() :: {:derive, derivations()}
@type start_opts() :: [start_opt()]
@type updater() ::
  (Lexical.Document.t() -> {:ok, Lexical.Document.t()} | {:error, any()})

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec close(Lexical.uri()) :: :ok | {:error, :not_open}
@spec fetch(Lexical.uri()) :: {:ok, Lexical.Document.t()} | {:error, :not_open}
@spec fetch(Lexical.uri(), derivation_key()) ::
  {:ok, Lexical.Document.t(), derived_value()} | {:error, :not_open}
Link to this function

get_and_update(uri, update_fn)

View Source
@spec get_and_update(Lexical.uri(), updater()) ::
  {:ok, Lexical.Document.t()} | {:error, any()}
Link to this function

open(uri, text, version)

View Source
@spec open(Lexical.uri(), String.t(), pos_integer()) :: :ok | {:error, :already_open}
@spec open?(Lexical.uri()) :: boolean()
Link to this function

open_temporary(uri, timeout \\ 5000)

View Source
@spec open_temporary(Lexical.uri() | Path.t(), timeout()) ::
  {:ok, Lexical.Document.t()} | {:error, term()}
@spec save(Lexical.uri()) :: :ok | {:error, :not_open}
@spec start_link(start_opts()) :: GenServer.on_start()
@spec update(Lexical.uri(), updater()) :: :ok | {:error, any()}