mdb_env_sync function

int mdb_env_sync(
  1. Pointer<MDB_env> env,
  2. int force
)

@brief 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. @paramin env An environment handle returned by #mdb_env_create() @paramin force 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. @return 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.

Implementation

@ffi.FfiNative<ffi.Int Function(ffi.Pointer<MDB_env>, ffi.Int)>('mdb_env_sync')
external int mdb_env_sync(
  ffi.Pointer<MDB_env> env,
  int force,
);