Geolix.Adapter behaviour (Geolix v2.0.0) View Source

Adapter behaviour module.

Link to this section Summary

Callbacks

Returns the adapter processes to be supervised.

Loads a given database into Geolix.

Looks up IP information.

Returns metadata information for a database if available.

Unloads a given database from Geolix.

Link to this section Callbacks

Link to this callback

database_workers(database)

View Source (optional)

Specs

database_workers(database :: Geolix.database()) :: [
  :supervisor.child_spec() | {module(), term()} | module()
]

Returns the adapter processes to be supervised.

If no automatic supervision should take place or it is intended to use an adapter specific supervisor (e.g. using the application config) this callback should be either unimplemented or return an empty list.

Link to this callback

load_database(database)

View Source (optional)

Specs

load_database(database :: Geolix.database()) ::
  :ok | :delayed | {:error, term()}

Loads a given database into Geolix.

Requires at least the fields :id and :adapter. Any other required fields depend on the adapter's requirements.

Link to this callback

lookup(ip, opts, database)

View Source

Specs

lookup(
  ip :: :inet.ip_address(),
  opts :: Keyword.t(),
  database :: Geolix.database()
) :: map() | nil

Looks up IP information.

Link to this callback

metadata(database)

View Source (optional)

Specs

metadata(database :: Geolix.database()) :: map() | nil

Returns metadata information for a database if available.

Link to this callback

unload_database(database)

View Source (optional)

Specs

unload_database(database :: Geolix.database()) :: :ok

Unloads a given database from Geolix.