lmdb_master_sys

Function mdb_env_sync

Source
pub unsafe extern "C" fn mdb_env_sync(
    env: *mut MDB_env,
    force: c_int,
) -> c_int
Expand description

Flush the data buffers to disk.

Data is always written to disk when #mdb_txn_commit() is called, but the operating system may keep it buffered. LMDB always flushes the OS buffers upon commit as well, unless the environment was opened with #MDB_NOSYNC or in part #MDB_NOMETASYNC. This call is not valid if the environment was opened with #MDB_RDONLY.

§Arguments

  • env (direction in) - An environment handle returned by #mdb_env_create()
  • force (direction in) - If non-zero, force a synchronous flush. Otherwise if the environment has the #MDB_NOSYNC flag set the flushes will be omitted, and with #MDB_MAPASYNC they will be asynchronous.

§Returns

A non-zero error value on failure and 0 on success. Some possible errors are:

  • EACCES - the environment is read-only.
  • EINVAL - an invalid parameter was specified.
  • EIO - an error occurred during synchronization.