elixir-geolix/geolix

Make build_epoch from metadata readable

ook opened this issue · 5 comments

ook commented

It seems there's no method to reach the database metadata.
The one I'd like to see is build_epoch (https://maxmind.github.io/MaxMind-DB/#build_epoch) to let application know if the database is fresh enough.

Does such metadata access already exists?

Thank you.

Not yet.

I assume you do want to check if the database in your filesystem is newer in comparison to the one currently loaded, right?

Right now there are only some workarounds or internal methods to access the metadata. One would be to call Geolix.Adapter.MMDB2.Storage.Metadata(:your_database_id) but that module will vanish in a future release.

We could solve that problem by extending the database state returned by Geolix.Database.Loader.get_database/1 to include additional information. The MMDB2 adapter could add the :build_epoch while the Fake adapter could add the unix timestamp of the time it was last loaded. Or perhaps a more generic entry that every adapter could fill to it's liking.

ook commented

Here some suggestion to expose metada: a new dedicated worker call.

I like that PR :)

Are you actively using the branch in a project or can I do a force push for some minor adjustments like replacing your fork in the adapter PR after it is merged here?

ook commented

I'm using it in… production 🙄… but yes you can make the modifications you need: that won't interfere with my stack :)

Closing in favor of the pull requests :)