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, opts \\ [])

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. See MscmpSystDb.Types.DatastoreOptions.t/0 for 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/0 or nil) - Specifies the registry to use for registering named Datastore Contexts. Can be :local, :global, a tuple of {module(), term()}, or nil. Commonly, this is a tuple of {Registry, registry_name}.

Returns

start_link(datastore_options, datastore_context, opts \\ [])

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 the datastore_options parameter for MscmpSystDb.DatastoreContext.child_spec/3. This option is required.

  • datastore_context - a required map describing the Context to be started. See t: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/0 or nil) - Specifies the registry to use for registering named Datastore Contexts. Can be :local, :global, a tuple of {module(), term()}, or nil. Commonly, this is a tuple of {Registry, registry_name}.