Geolix.Adapter behaviour
(Geolix v2.1.0)
View Source
Adapter behaviour module.
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.
Callbacks
@callback 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.
@callback 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.
@callback lookup( ip :: :inet.ip_address(), opts :: Keyword.t(), database :: Geolix.database() ) :: map() | nil
Looks up IP information.
@callback metadata(database :: Geolix.database()) :: map() | nil
Returns metadata information for a database if available.
@callback unload_database(database :: Geolix.database()) :: :ok
Unloads a given database from Geolix.