Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Issue #13 - Add reader mode information to reader metadata object #14

Closed
wants to merge 2 commits into from

Conversation

beamerblvd
Copy link

Implemented issue #13. Compiled libmaxminddb locally, compiled maxminddb.extension against it locally, and tested with all modes explicit and with MODE_AUTO. Works great!

@oschwald
Copy link
Member

oschwald commented Apr 7, 2015

Thanks for the PR. The metadata is metadata associated with the database file. I think this might be more appropriate as a property on the reader class itself.

@beamerblvd
Copy link
Author

That's easy enough. I'll tweak the PR and resubmit in an hour or so.

On Apr 7, 2015, at 17:47, Gregory Oschwald notifications@github.com wrote:

Thanks for the PR. The metadata is metadata associated with the database file. I think this might be more appropriate as a property on the reader class itself.


Reply to this email directly or view it on GitHub.

@mattrobenolt
Copy link

Just a drive by opinion, if this is done, why not use the constants already available, then you could assert against them? Like:

assert db.mode == maxminddb.MODE_MMAP_EXT

Instead of then using a string prone to typos, etc.

On a more related node, we confirm that the C extension is installed by just checking python -c 'import maxminddb.extension; maxminddb.extension.Reader' and this would error and exit with something non-0.

It's not perfect, but it works since you're right, it's pretty opaque on what's being used. I think this check is sufficient though since if you're using AUTO, the only options in reality are MMAP_EXT or MMAP, unless for some reason you're running on a python that doesn't even have mmap (I'm not even aware of when this condition would happen). The C extension only supports mmap. So this check is sufficient to assert which mode we're going to get at CI/build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants