blogit v1.2.1 Blogit.Logic.Updater View Source

Contains the function check_updates/1 for checking for new updates using a Blogit.RepositoryProvider module implementation.

Checking for updates should be done in a specific process, so the main posts repository is not blocked while checking for updates.

Link to this section Summary

Functions

Checks for new updates of the state in the remote/local repository. The state should contain a Blogit.RepositoryProvider struct

Link to this section Types

Link to this type check_updates_result() View Source
check_updates_result ::
  :no_updates |
  {:updates, %{posts: %{optional(atom) => Blogit.Models.Post.t}, configurations: [Blogit.Models.Configuration.t]}}

Link to this section Functions

Checks for new updates of the state in the remote/local repository. The state should contain a Blogit.RepositoryProvider struct.

If there are no updates in the repository, the atom :no_updates is returned.

If there are updates in the repository, a tuple of two elements is returned:

{
  :updates,
  %{posts: <updated-posts-as-map>, configurations: <updated-configuration>}
}

This function is called in a supervised Task by the Blogit.Server process.