Skip to content

Commit

Permalink
feat(lmdb): add u64 as mapsize arg
Browse files Browse the repository at this point in the history
  • Loading branch information
elendilm committed Jun 1, 2021
1 parent 52067bd commit b4206cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions liblmdb-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b4206cf

Please sign in to comment.