libmdbx  0.11.6.39 (2022-04-13T11:05:50+03:00)
One of the fastest compact embeddable key-value ACID database without WAL.
mdbx::env_managed Class Reference

Managed database environment. More...

#include <mdbx.h++>

Inherits mdbx::env.

Classes

struct  create_parameters
 Additional parameters for creating a new database. More...
 

Public Member Functions

MDBX_CXX11_CONSTEXPR env_managed () noexcept=default
 
 env_managed (const MDBX_STD_FILESYSTEM_PATH &, const operate_parameters &, bool accede=true)
 Open existing database. More...
 
 env_managed (const ::std::string &, const operate_parameters &, bool accede=true)
 
 env_managed (const MDBX_STD_FILESYSTEM_PATH &, const create_parameters &, const operate_parameters &, bool accede=true)
 Create new or open existing database. More...
 
 env_managed (const ::std::string &, const create_parameters &, const operate_parameters &, bool accede=true)
 
void close (bool dont_sync=false)
 Explicitly closes the environment and release the memory map. More...
 
 env_managed (env_managed &&)=default
 
env_managedoperator= (env_managed &&other)
 
 env_managed (const env_managed &)=delete
 
env_managedoperator= (const env_managed &)=delete
 
virtual ~env_managed () noexcept
 
- Public Member Functions inherited from mdbx::env
MDBX_CXX11_CONSTEXPR env () noexcept=default
 
 env (const env &) noexcept=default
 
envoperator= (env &&other) noexcept
 
 env (env &&other) noexcept
 
 ~env () noexcept
 
MDBX_CXX14_CONSTEXPR operator bool () const noexcept
 
MDBX_CXX14_CONSTEXPR operator const MDBX_env * () const
 
MDBX_CXX14_CONSTEXPR operator MDBX_env * ()
 
env::operate_parameters get_operation_parameters () const
 Returns current operation parameters. More...
 
env::mode get_mode () const
 Returns current operation mode. More...
 
env::durability get_durability () const
 Returns current durability mode. More...
 
env::reclaiming_options get_reclaiming () const
 Returns current reclaiming options. More...
 
env::operate_options get_options () const
 Returns current operate options. More...
 
bool is_pristine () const
 Returns true for a freshly created database, but false if at least one transaction was committed. More...
 
bool is_empty () const
 Checks whether the database is empty. More...
 
size_t dbsize_min () const
 Returns the minimal database size in bytes for the environment. More...
 
size_t dbsize_max () const
 Returns the maximal database size in bytes for the environment. More...
 
size_t key_min (key_mode mode) const noexcept
 Returns the minimal key size in bytes for specified keys mode. More...
 
size_t key_max (key_mode mode) const
 Returns the maximal key size in bytes for specified keys mode. More...
 
size_t value_min (value_mode mode) const noexcept
 Returns the minimal value size in bytes for specified values mode. More...
 
size_t value_max (value_mode mode) const
 Returns the maximal value size in bytes for specified values mode. More...
 
size_t transaction_size_max () const
 Returns the maximal write transaction size (i.e. limit for summary volume of dirty pages) in bytes. More...
 
envcopy (const MDBX_STD_FILESYSTEM_PATH &destination, bool compactify, bool force_dynamic_size=false)
 Make a copy (backup) of an existing environment to the specified path. More...
 
envcopy (const ::std::string &destination, bool compactify, bool force_dynamic_size=false)
 
envcopy (filehandle fd, bool compactify, bool force_dynamic_size=false)
 Copy an environment to the specified file descriptor. More...
 
stat get_stat () const
 Returns snapshot statistics about the MDBX environment. More...
 
size_t get_pagesize () const
 Returns pagesize of this MDBX environment. More...
 
info get_info () const
 Return snapshot information about the MDBX environment. More...
 
stat get_stat (const txn &) const
 Return statistics about the MDBX environment accordingly to the specified transaction. More...
 
info get_info (const txn &) const
 Return information about the MDBX environment accordingly to the specified transaction. More...
 
filehandle get_filehandle () const
 Returns the file descriptor for the DXB file of MDBX environment. More...
 
path get_path () const
 Return the path that was used for opening the environment. More...
 
MDBX_env_flags_t get_flags () const
 Returns environment flags. More...
 
unsigned max_readers () const
 Returns the maximum number of threads/reader slots for the environment. More...
 
unsigned max_maps () const
 Returns the maximum number of named databases for the environment. More...
 
void * get_context () const noexcept
 Returns the application context associated with the environment. More...
 
envset_context (void *)
 Sets the application context associated with the environment. More...
 
envset_sync_threshold (size_t bytes)
 Sets threshold to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period (unsigned seconds_16dot16)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
envset_sync_period (double seconds)
 Sets relative period since the last unsteady commit to force flush the data buffers to disk, for non-sync durability modes. More...
 
envalter_flags (MDBX_env_flags_t flags, bool on_off)
 Alter environment flags. More...
 
envset_geometry (const geometry &size)
 Set all size-related parameters of environment. More...
 
bool sync_to_disk (bool force=true, bool nonblock=false)
 Flush the environment data buffers. More...
 
bool poll_sync_to_disk ()
 Performs non-blocking polling of sync-to-disk thresholds. More...
 
void close_map (const map_handle &)
 Close a key-value map (aka sub-database) handle. Normally unnecessary. More...
 
template<typename VISITOR >
int enumerate_readers (VISITOR &visitor)
 Enumerate readers. More...
 
unsigned check_readers ()
 Checks for stale readers in the lock table and return number of cleared slots. More...
 
envset_HandleSlowReaders (MDBX_hsr_func *)
 Sets a Handle-Slow-Readers callback to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
MDBX_hsr_funcget_HandleSlowReaders () const noexcept
 Returns the current Handle-Slow-Readers callback used to resolve database full/overflow issue due to a reader(s) which prevents the old data from being recycled. More...
 
txn_managed start_read () const
 Starts read (read-only) transaction. More...
 
txn_managed prepare_read () const
 Creates but not start read transaction. More...
 
txn_managed start_write (bool dont_wait=false)
 Starts write (read-write) transaction. More...
 
txn_managed try_start_write ()
 Tries to start write (read-write) transaction without blocking. More...
 

Additional Inherited Members

- Public Types inherited from mdbx::env
enum  mode { readonly, write_file_io, write_mapped_io }
 Operation mode. More...
 
enum  durability { robust_synchronous, half_synchronous_weak_last, lazy_weak_tail, whole_fragile }
 Durability level. More...
 
enum  remove_mode { just_remove = MDBX_ENV_JUST_DELETE, ensure_unused = MDBX_ENV_ENSURE_UNUSED, wait_for_unused = MDBX_ENV_WAIT_FOR_UNUSED }
 Deletion modes for remove(). More...
 
using stat = ::MDBX_stat
 Statistics for a database in the MDBX environment. More...
 
using info = ::MDBX_envinfo
 Information about the environment. More...
 
- Static Public Member Functions inherited from mdbx::env
static size_t default_pagesize () noexcept
 Returns default page size for current system/platform. More...
 
static bool remove (const MDBX_STD_FILESYSTEM_PATH &, const remove_mode mode=just_remove)
 Removes the environment's files in a proper and multiprocess-safe way. More...
 
static bool remove (const ::std::string &, const remove_mode mode=just_remove)
 
- Protected Member Functions inherited from mdbx::env
MDBX_CXX11_CONSTEXPR env (MDBX_env *ptr) noexcept
 
- Protected Attributes inherited from mdbx::env
MDBX_envhandle_ {nullptr}
 

Detailed Description

Managed database environment.

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 databases (aka key-value spaces or tables), all residing in the same shared-memory map.

Constructor & Destructor Documentation

◆ env_managed() [1/7]

MDBX_CXX11_CONSTEXPR mdbx::env_managed::env_managed ( )
defaultnoexcept

◆ env_managed() [2/7]

mdbx::env_managed::env_managed ( const MDBX_STD_FILESYSTEM_PATH ,
const operate_parameters ,
bool  accede = true 
)

Open existing database.

◆ env_managed() [3/7]

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

◆ env_managed() [4/7]

mdbx::env_managed::env_managed ( const MDBX_STD_FILESYSTEM_PATH ,
const create_parameters ,
const operate_parameters ,
bool  accede = true 
)

Create new or open existing database.

◆ env_managed() [5/7]

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

◆ env_managed() [6/7]

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

◆ env_managed() [7/7]

mdbx::env_managed::env_managed ( const env_managed )
delete

◆ ~env_managed()

virtual mdbx::env_managed::~env_managed ( )
virtualnoexcept

Member Function Documentation

◆ close()

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

Explicitly closes the environment and release the memory map.

Only a single thread may call this function. All transactions, databases, 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
[in]dont_syncA dont'sync flag, if non-zero the last checkpoint will be kept "as is" and may be still "weak" in the lazy_weak_tail or 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.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

The documentation for this class was generated from the following file: