Git Product home page Git Product logo

Comments (9)

oschwald avatar oschwald commented on June 2, 2024

I have consider this in the past, but I am not sure we want to expose all of the metadata as much of it is internal information about the structure of the database. From your description, I assume you are primarily interested in the build date. Is this correct?

from geoip2-java.

ikalatch avatar ikalatch commented on June 2, 2024

Correct - the build date and the major binary version (to make sure that the db format was not changed in a way that it will become unreadable to the current code version).

From what I see in the metadata structure these three are definitely important:
"binary_format_major_version"
"binary_format_minor_version"
"build_epoch"

And this is nice to have as a general info:
"node_count"

Not sure if these contain any valuable info:
"database_type"
"languages"
"description"
"ip_version" (IPv4/IPv6)

Internal, not much business value:
"record_size"

from geoip2-java.

ikalatch avatar ikalatch commented on June 2, 2024

The problem is that the code has currently no way of figuring out if the geoIp DB is out of date and if it is binary compatible or not.

Sure, if the time stamp of the file is more than a month old we should probably go and download the latest one. But file timestamp alone is not a very reliable indicator - for example, a build or deployment process can copy a geo IP file somewhere and update the timestamp in the process.
This is why it is important to have an API to get some metadata out of the file.

Having direct access to the metadata would decrease the number of download requests to the site so it would be beneficial to MaxMind as well.

from geoip2-java.

oschwald avatar oschwald commented on June 2, 2024

I agree. We will need to refactor the metadata class before exposing it, but I think that at least some of the information in there is valuable to the users of the database.

from geoip2-java.

reutherM avatar reutherM commented on June 2, 2024

Is there any progress in providing the Maxmind database version via API? I think its very usefull for both sides!

Furthermore is there any more specific plan when the Java API will leave the Beta-version state?

from geoip2-java.

oschwald avatar oschwald commented on June 2, 2024

We are in the process of exposing the metadata. We expect to remove the beta label in early October.

from geoip2-java.

ikalatch avatar ikalatch commented on June 2, 2024

Great, thanks Greg!

Once the version is exposed via the API it would be nice to expose an endpoint on MaxMind's website to be able to get the version of the latest DB available for download. This way the code running on the client side can figure out if it makes sense to make the expensive (for both the client and MaxMind) call to download the latest DB.
For example, the latest GeoLite2-City.mmdb.gz file can be downloaded from /download/geoip/database/, it would be nice to have another URL that when called would return the version of the file(s) available for download in some common format (JSON, XML, etc.). It could be a single URL for all available files for download or a URL per file (could be a unique path or the same path, diff. URL query params). This way the client code can check the version of the currently downloaded DB, then call this URL and see what the version of the DB available for download is and if the two match - do nothing. If the one available at the MaxMind's site is newer - only then proceed with the download.

from geoip2-java.

oschwald avatar oschwald commented on June 2, 2024

Good idea. I'll pass it on.

There is now a getMetadata() method in the DatabaseReader class. This exposes most of the metadata.

from geoip2-java.

reutherM avatar reutherM commented on June 2, 2024

Thanks a lot for the fast reply. The getMetadata() method works great!

from geoip2-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.