Using behaviours

One of the core parts of our project will be how we store and retrieve files on the cloud on behalf of our users. We decided not to place this component under its own umbrella application, because it is possible to define a clear boundary between the ElixirDrip business logic and its storage counterpart under the same umbrella application. To achieve this separation of concerns, we will encapsulate all the storage logic under an ElixirDrip.Storage module. This module will be the single entry point for every storage-related operation, while encapsulating the actual implementation details.

We will start by creating a StorageProvider behaviour, which defines two callbacks to be implemented and relies on typespecs to indicate, ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.