blogit v1.2.3 Blogit.Supervisor View Source

This module represents the root Supervisor of Blogit.

It uses a one_for_all strategy to supervise its children. The children are:

  • Blogit.Server worker used as the core process of Blogit. If it fails all the top-level processes of the application must be restarted, thus the one_for_all strategy.
  • Blogit.Components.Supervisor supervisor which supervises the components of Blogit that can be queried. If this process fails it will be good to restart all the top-level processes, because the Blogit.Server process is used by the components to manage their data.
  • A Task.Supervisor used to supervise all the Tasks in Blogit.
  • If the Applications is using the Blogit.RepositoryProviders.Memory provider, a worker representing the in-memory repository is started and supervised too.

Blogit.Supervisor is started in Blogit.start/2 using Blogit.Supervisor.start_link/1 and the result of this call is what the start function of the Blogit application returns.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for Supervisor.init/1.

Accepts a module implementing Blogit.RepositoryProvider and starts the supervisor defined by this module.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

init(repository_provider)

View Source

Callback implementation for Supervisor.init/1.

Link to this function

start_link(repository_provider)

View Source
start_link(module()) :: Supervisor.on_start()

Accepts a module implementing Blogit.RepositoryProvider and starts the supervisor defined by this module.

The Blogit.RepositoryProvider module is passed to the Supervisor.init/1 callback implemented by this module and is used to create and start the Blogit.Server worker.

This function is called by Blogit.start/2 and its result is returned by it.