MscmpSystDb.DatastoreContext (mscmp_syst_db v0.1.0)
Provides basic OTP related features for Datastore Contexts.
Usually functions in this API are called when processing
MscmpSystDb.Datastore
module functions. However, there are times
when direct Datastore Context manipulation is appropriate, such as stopping
and then restarting a specific Context for maintenance reasons.
Summary
Functions
Returns the Child Specification used to start the DatastoreContext service.
Starts a Datastore Context as a linked process to the caller.
Functions
child_spec(datastore_options, context_name, opts \\ [])
@spec child_spec( MscmpSystDb.Types.DatastoreOptions.t(), MscmpSystDb.Types.context_name(), Keyword.t() ) :: Supervisor.child_spec()
Returns the Child Specification used to start the DatastoreContext service.
Parameters
datastore_options
- a required Map of values which describe the Datastore and Datastore Context related connection options. SeeMscmpSystDb.Types.DatastoreOptions.t/0
for more.context_name
- the identity of the context as understood by the system. The context name is both the identity of the context as an Ecto Repo and is also used for the child specification ID value as there is the possibility of multiple contexts to start under the Datastore Supervisor process.options
- a Keyword List of optional values. Currently there are no attributes which are expected in this list and it is safe to omit.
start_link(opts \\ [])
@spec start_link(Keyword.t()) :: Supervisor.on_start()
Starts a Datastore Context as a linked process to the caller.
Typically this function is called once for each Context defined for a
Datastore by the MscmpSystDb.Datastore.start_link/1
function.
However there are some cases where starting a Datastore Context independently
can be desirable, such as the Context was earlier stopped for some reason and
needs to be started under it's original Datastore Supervisor.
Options
name
- see thecontext_name
parameter forMscmpSystDb.DatastoreContext.child_spec/3
.datastore_options
- see thedatastore_options
parameter forMscmpSystDb.DatastoreContext.child_spec/3
. This option is required.context
- a required map describing the Context to be started. Seet:MscmpSystDb.Types.datastore_context()
for more information.