From b4206cfb45d28204f0a3dc3747dda794dd414652 Mon Sep 17 00:00:00 2001 From: Muneer Date: Wed, 2 Jun 2021 04:45:58 +0530 Subject: [PATCH] feat(lmdb): add u64 as mapsize arg --- liblmdb-sys/src/lib.rs | 4 ++-- src/core.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/liblmdb-sys/src/lib.rs b/liblmdb-sys/src/lib.rs index 3616eac7..3790d2e1 100755 --- a/liblmdb-sys/src/lib.rs +++ b/liblmdb-sys/src/lib.rs @@ -63,7 +63,7 @@ pub struct MDB_stat { #[allow(missing_copy_implementations)] pub struct MDB_envinfo { pub me_mapaddr: *const c_void, - pub me_mapsize: size_t, + pub me_mapsize: u64, pub me_last_pgno: size_t, pub me_last_txnid: size_t, pub me_maxreaders: c_uint, @@ -162,7 +162,7 @@ extern "C" { pub fn mdb_env_get_flags(env: *mut MDB_env, flags: *mut c_uint) -> c_int; pub fn mdb_env_get_path(env: *mut MDB_env, path: *mut *mut c_char) -> c_int; pub fn mdb_env_get_fd(env: *mut MDB_env, fd: *mut mdb_filehandle_t) -> c_int; - pub fn mdb_env_set_mapsize(env: *mut MDB_env, size: size_t) -> c_int; + pub fn mdb_env_set_mapsize(env: *mut MDB_env, size: u64) -> c_int; pub fn mdb_env_set_maxreaders(env: *mut MDB_env, readers: c_uint) -> c_int; pub fn mdb_env_get_maxreaders(env: *mut MDB_env, readers: *mut c_uint) -> c_int; pub fn mdb_env_set_maxdbs(env: *mut MDB_env, dbs: MDB_dbi) -> c_int; diff --git a/src/core.rs b/src/core.rs index c5113019..cbb7a7db 100644 --- a/src/core.rs +++ b/src/core.rs @@ -619,7 +619,7 @@ impl EnvBuilder { try_mdb!(unsafe { ffi::mdb_env_set_flags(env, self.flags.bits() & changeable_flags.bits(), 1)}); if let Some(map_size) = self.map_size { - try_mdb!(unsafe { ffi::mdb_env_set_mapsize(env, map_size as size_t)}); + try_mdb!(unsafe { ffi::mdb_env_set_mapsize(env, map_size)}); } if let Some(max_readers) = self.max_readers { @@ -751,8 +751,8 @@ impl Environment { /// Sets map size. /// This can be called after [open](struct.EnvBuilder.html#method.open) if no transactions are active in this process. - pub fn set_mapsize(&self, map_size: usize) -> MdbResult<()> { - lift_mdb!(unsafe { ffi::mdb_env_set_mapsize(self.env.0, map_size as size_t)}) + pub fn set_mapsize(&self, map_size: u64) -> MdbResult<()> { + lift_mdb!(unsafe { ffi::mdb_env_set_mapsize(self.env.0, map_size)}) } /// This one sets only flags which are available for change even