Skip to content

Class mdbx::env_managed

ClassList > mdbx > env_managed

Managed database environment. More...

  • #include <mdbx.h++>

Inherits the following classes: mdbx::env

Classes

Type Name
struct create_parameters
Additional parameters for creating a new database.

Public Types inherited from mdbx::env

See mdbx::env

Type Name
enum int defrag_control
Control values returned by the defragmentation progress visitor.
typedef ::MDBX_defrag_result_t defrag_result
The result of database defragmentation, see MDBX_defrag_result_t .
enum unsigned durability
Durability level.
enum extra_runtime_option
MDBX environment extra runtime options.
typedef ::MDBX_envinfo info
Information about the environment.
enum unsigned mode
Operation mode.
enum remove_mode
Deletion modes for remove() .
typedef ::MDBX_stat stat
Statistics for a database in the MDBX environment.

Public Functions

Type Name
void close (bool dont_sync=false)
Explicitly closes the environment and release the memory map.
constexpr env_managed () noexcept
env_managed (const ::mdbx::filesystem::path & pathname, const operate_parameters &, bool accede=true)
Open existing database.
env_managed (const ::std::wstring & pathname, const operate_parameters &, bool accede=true)
env_managed (const wchar_t * pathname, const operate_parameters &, bool accede=true)
env_managed (const ::std::string & pathname, const operate_parameters &, bool accede=true)
env_managed (const char * pathname, const operate_parameters &, bool accede=true)
env_managed (const ::mdbx::filesystem::path & pathname, const create_parameters &, const operate_parameters &, bool accede=true)
Create new or open existing database.
env_managed (const ::std::wstring & pathname, const create_parameters &, const operate_parameters &, bool accede=true)
env_managed (const wchar_t * pathname, const create_parameters &, const operate_parameters &, bool accede=true)
env_managed (const ::std::string & pathname, const create_parameters &, const operate_parameters &, bool accede=true)
env_managed (const char * pathname, const create_parameters &, const operate_parameters &, bool accede=true)
env_managed (env_managed &&) = default
env_managed (const env_managed &) = delete
env_managed & operator= (env_managed && other) noexcept
env_managed & operator= (const env_managed &) = delete
virtual ~env_managed ()

Public Functions inherited from mdbx::env

See mdbx::env

Type Name
env & copy (const ::mdbx::filesystem::path & destination, bool compactify, bool force_dynamic_size=false)
Make a copy (backup) of an existing environment to the specified path.
env & copy (const ::std::wstring & destination, bool compactify, bool force_dynamic_size=false)
env & copy (const wchar_t * destination, bool compactify, bool force_dynamic_size=false)
env & copy (const ::std::string & destination, bool compactify, bool force_dynamic_size=false)
env & copy (const char * destination, bool compactify, bool force_dynamic_size=false)
env & copy (filehandle fd, bool compactify, bool force_dynamic_size=false)
Copy an environment to the specified file descriptor.
size_t dbsize_max () const
Returns the maximal database size in bytes for the environment.
size_t dbsize_min () const
Returns the minimal database size in bytes for the environment.
constexpr env () noexcept
env (const env &) noexcept
size_t get_pagesize () const
Returns pagesize of this MDBX environment.
const path_char * get_path () const
Return the path that was used for opening the environment.
const MDBX_env * handle () noexcept const
MDBX_env * handle () noexcept
bool is_cooperative () const
bool is_empty () const
Checks whether the database is empty.
bool is_exclusive () const
bool is_nested_transactions_available () const
bool is_pristine () const
Returns true for a freshly created database, butfalse if at least one transaction was committed.
bool is_readonly () const
bool is_readwrite () const
bool is_writemap () const
size_t key_max (key_mode mode) const
Returns the maximal key size in bytes for specified keys mode.
size_t key_min (key_mode mode) noexcept const
Returns the minimal key size in bytes for specified keys mode.
constexpr operator MDBX_env * () noexcept
constexpr operator const MDBX_env * () noexcept const
env & operator= (const env &) noexcept
bool poll_sync_to_disk ()
Performs non-blocking polling of sync-to-disk thresholds.
env & set_sync_period (const duration & period)
Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes.
duration sync_period () const
Gets relative period since the last unsteady commit that used to force flush the data buffers to disk, for non-sync durability modes.
size_t transaction_size_max () const
Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes.
size_t value_max (value_mode mode) const
Returns the maximal value size in bytes for specified values mode.
size_t value_min (value_mode mode) noexcept const
Returns the minimal value size in bytes for specified values mode.

Public Static Functions

Type Name
env_managed open_for_recovery (const char * pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
Opens an environment instance using a specific meta-page for checking and recovery.
env_managed open_for_recovery (const ::std::string & pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
env_managed open_for_recovery (const ::mdbx::filesystem::path & pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
env_managed open_for_recovery (const wchar_t * pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)
env_managed open_for_recovery (const ::std::wstring & pathname, unsigned target_meta, bool writeable, unsigned max_maps=2)

Public Static Functions inherited from mdbx::env

See mdbx::env

Type Name
size_t default_pagesize () noexcept
Returns default page size for current system/platform.
MDBX_NODISCARD info get_preopen_snapinfo (const ::std::wstring & pathname)
MDBX_NODISCARD info get_preopen_snapinfo (const wchar_t * pathname)
bool remove (const ::mdbx::filesystem::path & pathname, const remove_mode mode=just_remove)
Removes the environment's files in a proper and multiprocess-safe way.
bool remove (const ::std::wstring & pathname, const remove_mode mode=just_remove)
bool remove (const wchar_t * pathname, const remove_mode mode=just_remove)
bool remove (const ::std::string & pathname, const remove_mode mode=just_remove)
bool remove (const char * pathname, const remove_mode mode=just_remove)

Protected Attributes inherited from mdbx::env

See mdbx::env

Type Name
MDBX_env * handle_ = {nullptr}

Detailed Description

As other managed classes, env_managed destroys the represented underlying object from the own class destructor, but disallows copying and assignment for instances.

An environment supports multiple key-value tables (aka key-value spaces or maps), all residing in the same shared-memory mapped file.

Public Functions Documentation

function close

Explicitly closes the environment and release the memory map.

void mdbx::env_managed::close (
    bool dont_sync=false
) 

Only a single thread may call this function. All transactions, tables, and cursors must already be closed before calling this function. Attempts to use any such handles after calling this function will cause a SIGSEGV. The environment handle will be freed and must not be used again after this call.

Parameters:

  • dont_sync The dont_sync flag, if non-zero the last checkpoint will be kept "as is" and may be still "weak" in the env::durability::lazy_weak_tail or env::durability::whole_fragile modes. Such "weak" checkpoint will be ignored on opening next time, and transactions since the last non-weak checkpoint (meta-page update) will rolledback for consistency guarantee.

function env_managed [2/14]

constexpr mdbx::env_managed::env_managed () noexcept

function env_managed [3/14]

Open existing database.

mdbx::env_managed::env_managed (
    const ::mdbx::filesystem::path & pathname,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [4/14]

mdbx::env_managed::env_managed (
    const ::std::wstring & pathname,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [5/14]

explicit mdbx::env_managed::env_managed (
    const wchar_t * pathname,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [6/14]

mdbx::env_managed::env_managed (
    const ::std::string & pathname,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [7/14]

explicit mdbx::env_managed::env_managed (
    const char * pathname,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [8/14]

Create new or open existing database.

mdbx::env_managed::env_managed (
    const ::mdbx::filesystem::path & pathname,
    const create_parameters &,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [9/14]

mdbx::env_managed::env_managed (
    const ::std::wstring & pathname,
    const create_parameters &,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [10/14]

explicit mdbx::env_managed::env_managed (
    const wchar_t * pathname,
    const create_parameters &,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [11/14]

mdbx::env_managed::env_managed (
    const ::std::string & pathname,
    const create_parameters &,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [12/14]

explicit mdbx::env_managed::env_managed (
    const char * pathname,
    const create_parameters &,
    const operate_parameters &,
    bool accede=true
) 

function env_managed [13/14]

mdbx::env_managed::env_managed (
    env_managed &&
) = default

function env_managed [14/14]

mdbx::env_managed::env_managed (
    const env_managed &
) = delete

function operator=

env_managed & mdbx::env_managed::operator= (
    env_managed && other
) noexcept

function operator=

env_managed & mdbx::env_managed::operator= (
    const env_managed &
) = delete

function ~env_managed

virtual mdbx::env_managed::~env_managed () 

Public Static Functions Documentation

function open_for_recovery [1/5]

Opens an environment instance using a specific meta-page for checking and recovery.

static env_managed mdbx::env_managed::open_for_recovery (
    const char * pathname,
    unsigned target_meta,
    bool writeable,
    unsigned max_maps=2
) 

Creates a new environment and opens it in the recovery mode, bypassing the regular consistency checks. Mostly an internal API for the mdbx_chk utility and subject to change; use only when you know what you are doing. The opened environment may be used e.g. with env::chk() and env::turn_for_recovery().

Parameters:

  • pathname The path to the database file.
  • target_meta The number of the meta-page to use (0..2), or any value for the default behavior.
  • writeable Whether to open in read-write mode.
  • max_maps The maximum number of named tables/maps, must be set before opening; zero means the library default. The recovery tooling uses 2 (MainDB+GC).

See also: mdbx_env_open_for_recovery()


function open_for_recovery [2/5]

static env_managed mdbx::env_managed::open_for_recovery (
    const ::std::string & pathname,
    unsigned target_meta,
    bool writeable,
    unsigned max_maps=2
) 

function open_for_recovery [3/5]

static env_managed mdbx::env_managed::open_for_recovery (
    const ::mdbx::filesystem::path & pathname,
    unsigned target_meta,
    bool writeable,
    unsigned max_maps=2
) 

function open_for_recovery [4/5]

static env_managed mdbx::env_managed::open_for_recovery (
    const wchar_t * pathname,
    unsigned target_meta,
    bool writeable,
    unsigned max_maps=2
) 

function open_for_recovery [5/5]

static env_managed mdbx::env_managed::open_for_recovery (
    const ::std::wstring & pathname,
    unsigned target_meta,
    bool writeable,
    unsigned max_maps=2
) 


The documentation for this class was generated from the following file docs/mdbx.h++