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
@spec child_spec( MscmpSystDb.Types.DatastoreOptions.t(), MscmpSystDb.Types.context_name() | MscmpSystDb.Types.DatastoreContext.t(), 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/0for more.context- 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.opts- a Keyword List of additional key/value call configurations. See the "Options" section for details.
Options
:context_registry(Msutils.Types.Process.registry/0ornil) - Specifies the registry to use for registering named Datastore Contexts. Can be:local,:global, a tuple of{module(), term()}, ornil. Commonly, this is a tuple of{Registry, registry_name}.
Returns
Supervisor.child_spec/0- The Child Specification for the Datastore Context to be started.
@spec start_link( MscmpSystDb.Types.DatastoreOptions.t(), MscmpSystDb.Types.DatastoreContext.t(), 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.
Parameters
datastore_options- see thedatastore_optionsparameter forMscmpSystDb.DatastoreContext.child_spec/3. This option is required.datastore_context- a required map describing the Context to be started. Seet:MscmpSystDb.Types.datastore_context()for more information.opts- a Keyword List of additional key/value call configurations. See the "Options" section for details.
Options
:context_registry(Msutils.Types.Process.registry/0ornil) - Specifies the registry to use for registering named Datastore Contexts. Can be:local,:global, a tuple of{module(), term()}, ornil. Commonly, this is a tuple of{Registry, registry_name}.