View Source ExMaps.DistanceMatrixCoordinator (ExMaps v1.1.3)

GenServer implementation for coordinating worker tasks related to the Distance Matrix API.

This module manages the spawning of worker tasks to handle multiple distance matrix requests concurrently, ensuring efficient processing of the requests.

Summary

Functions

Returns a specification to start this module under a supervisor.

Spawns worker tasks to handle the given coordinates and options for the distance matrix.

Starts the GenServer with optional configuration.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

spawn_workers(coordinates, options)

View Source
@spec spawn_workers(
  [map()],
  keyword()
) :: [any()]

Spawns worker tasks to handle the given coordinates and options for the distance matrix.

Parameters

  • coordinates: A list of coordinate maps.
  • options: A keyword list of options for the worker tasks.

Examples

iex> ExMaps.DistanceMatrixCoordinator.spawn_workers([%{origins: ["A"], destinations: ["B"]}], key: :value)
[%{...}, ...]

Returns

  • A list of results from the worker tasks.
Link to this function

start_link(options \\ [])

View Source
@spec start_link(keyword()) :: {:ok, pid()} | {:error, any()}

Starts the GenServer with optional configuration.

Parameters

  • options: A keyword list of options for the GenServer.

Examples

iex> ExMaps.DistanceMatrixCoordinator.start_link()
{:ok, pid}

Returns

  • {:ok, pid} on successful start
  • {:error, reason} if there is an error