Porterage v0.1.0 Porterage View Source
Checks, fetches and delivers configurable data sources.
Usage
Place a porterage instance in your supervision tree:
{Porterage,
%{
deliverer: MyDeliverer,
deliverer_opts: %{},
fetcher: MyFetcher,
fetcher_opts: %{},
scheduler: MyScheduler,
scheduler_opts: %{},
supervisor: [],
tester: MyTester,
tester_opts: %{}
}}
See config/0
for a specification of the available configuration keys.
Supervisor Configuration
If a :supervisor
key is set the values are passed
as the options argument to Supervisor.start_link/3
.
Data Flow
-
Depending on the
:scheduler
chosen a:tick
will start the data flow. -
If the scheduler decided it is time to test the data source the chosen
:tester
will receive a notification to do so. -
Every time a test for new data was deemed successful the
:fetcher
will retrieve the data to be delivered. -
Once the data was fetched in the previous step the
:deliverer
will take care of delivering it to the target.
Every step of the flow can be manually triggered.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Force a delivery for a specific instance with custom data.
Force a fetch for a specific instance.
Force a test for a specific instance.
Force a tick for a specific instance.
Link to this section Types
config()
View Sourceconfig() :: %{ :deliverer => module(), :fetcher => module(), :scheduler => module(), :tester => module(), optional(:deliverer_opts) => map(), optional(:fetcher_opts) => map(), optional(:scheduler_opts) => map(), optional(:supervisor) => [Supervisor.option() | Supervisor.init_option()], optional(:tester_opts) => map() }
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
deliver(supervisor, data)
View Sourcedeliver(Supervisor.supervisor(), any()) :: :ok | :error
Force a delivery for a specific instance with custom data.
Force a fetch for a specific instance.
Force a test for a specific instance.
Force a tick for a specific instance.