From 8b268314dc3e2180247ac84709b40243ddb73ab0 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Fri, 2 Dec 2022 11:43:00 +0000 Subject: [PATCH] To match the C signature mdb_env_set_mapsize(MDB_env *env, size_t size), add setindex! overload that takes a Csize_t argument. --- src/env.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/env.jl b/src/env.jl index 13f13a2..023272b 100644 --- a/src/env.jl +++ b/src/env.jl @@ -106,8 +106,6 @@ unset!(env::Environment, flag::EnvironmentFlags) = unset!(env, Cuint(flag)) function setindex!(env::Environment, val::Cuint, option::Symbol) if option == :Readers mdb_env_set_maxreaders(env.handle, val) - elseif option == :MapSize - mdb_env_set_mapsize(env.handle, val) elseif option == :DBs mdb_env_set_maxdbs(env.handle, val) else @@ -115,6 +113,16 @@ function setindex!(env::Environment, val::Cuint, option::Symbol) Cint(0) end end + +function setindex!(env::Environment, val::Csize_t, option::Symbol) + if option == :MapSize + println("Setting map size to: ", val) + mdb_env_set_mapsize(env.handle, 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