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

Link to this function

child_spec(datastore_options, context_name, 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_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.

Link to this function

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