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

allows large databases using Csize_t instead Cuint for :MapSize; fixe… #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,20 @@ unset!(env::Environment, flag::EnvironmentFlags) = unset!(env, Cuint(flag))
* DBs
* `value` parameter value

**Note:** Consult LMDB documentation for particual values of environment parameters and flags.
**Note:** Consult LMDB documentation for particular values of environment parameters and flags.
"""
function setindex!(env::Environment, val::Cuint, option::Symbol)
function setindex!(env::Environment, val::Int, option::Symbol)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use val::Integer instead to avoid breaking existing code

if option == :Readers
mdb_env_set_maxreaders(env.handle, val)
mdb_env_set_maxreaders(env.handle, Cuint(val))
elseif option == :MapSize
mdb_env_set_mapsize(env.handle, val)
mdb_env_set_mapsize(env.handle, Csize_t(val))
elseif option == :DBs
mdb_env_set_maxdbs(env.handle, val)
mdb_env_set_maxdbs(env.handle, Cuint(val))
else
@warn("Cannot set $(string(option)) value")
Cint(0)
end
end
setindex!(env::Environment, val::Int, option::Symbol) = setindex!(env, Cuint(val), option)

"""Get environment flags and parameters

Expand All @@ -126,9 +125,9 @@ setindex!(env::Environment, val::Int, option::Symbol) = setindex!(env, Cuint(val
* Readers
* KeySize

**Note:** Consult LMDB documentation for particual values of environment parameters and flags.
**Note:** Consult LMDB documentation for particular values of environment parameters and flags.
"""
function getindex(env::Environment, option::Symbol)
function getindex(env::Environment, option::Symbol)::Int
value = Cuint[0]
if option == :Flags
flags = Cuint[0]
Expand All @@ -140,7 +139,7 @@ function getindex(env::Environment, option::Symbol)
else
@warn("Cannot get $(string(option)) value")
end
return value[1]
return Int(value[1])
end

"""Return information about the LMDB environment."""
Expand Down
Loading