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

  1. Porterage.Scheduler

    Depending on the :scheduler chosen a :tick will start the data flow.

  2. Porterage.Tester

    If the scheduler decided it is time to test the data source the chosen :tester will receive a notification to do so.

  3. Porterage.Fetcher

    Every time a test for new data was deemed successful the :fetcher will retrieve the data to be delivered.

  4. Porterage.Deliverer

    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

Link to this type

config()

View Source
config() :: %{
  :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.

Link to this function

deliver(supervisor, data)

View Source
deliver(Supervisor.supervisor(), any()) :: :ok | :error

Force a delivery for a specific instance with custom data.

Link to this function

fetch(supervisor)

View Source
fetch(Supervisor.supervisor()) :: :ok | :error

Force a fetch for a specific instance.

Link to this function

test(supervisor)

View Source
test(Supervisor.supervisor()) :: :ok | :error

Force a test for a specific instance.

Link to this function

tick(supervisor)

View Source
tick(Supervisor.supervisor()) :: :ok | :error

Force a tick for a specific instance.