Lmdb::Environment
Inherits Lmdb::Base / Reference / Object
NOTE: See the lmdb.h file for detailed descriptions of how these functions work
Constructors
new(db_path : String, max_db_size = 10485760, flags : Lmdb::Flags::Environment = Lmdb::Flags::Environment::NO_TLS, file_permissions = 493, max_readers = 126, max_dbs = 0)
File permissions: The database will be created with these permissions default 755
`max_readers`:
Maximum number of simultaneous read transactions. Can only be set
by the first process to open an environment, as it affects the size
of the lock file and shared memory area. Attempts to simultaneously
start more than this many *read* transactions will fail.
Instance methods
close
Sourcecopy_to(destination_path : String, compact = false)
##/**Copy an LMDB environment to the specified path, with options. *
- This function may be used to make a backup of an existing environment.
- No lockfile is created, since it gets recreated at need.
create_subdir_if_not_exists(path : String, file_permissions)
Sourcedatabases
Sourceflush(force = true)
##/**@brief Flush the data buffers to disk. *
- Data is always written to disk when #mdb_txn_commit() is called,
- This function is not needed under normal circumstances.
- It's here just in case.
handle
Sourceinfo
- This gathers all information about the environment and gives it in a struct.
- It is not cached to reflect the latest true state of the env
open_database(database_name : String | Nil = nil, flags = Lmdb::Flags::Database::None)
Sourceread_only?
Sourceset_flags(flags : Lmdb::Flags::Environment, on_or_off = 1)
##/**@brief Set environment @flags. *
- This may be used to set some @flags in addition to those from
- #mdb_env_open(), or to unset these @flags. If several threads
- change the @flags at the same time, the result is undefined.
set_map_size(size : LibLmdb::SizeT | Int32)
##/**@brief Set the size of the memory map to use for this environment. *
- The size should be a multiple of the OS page size. The default is
- 10485760 bytes. The size of the memory map is also the maximum size
- of the database. The value should be chosen as large as possible,
- to accommodate future growth of the database.
set_max_dbs(max_dbs = 0.as(LibLmdb::MDB_dbi))
- This function is only needed if multiple databases will be used in the
- environment. Simpler applications that use the environment as a single
- unnamed database can ignore this option.
- This function may only be called after #mdb_env_create() and before #mdb_env_open().
set_max_readers(max_readers : LibC::UInt | Int32)
- This defines the number of slots in the lock table that is used to track readers in the
- the environment. The default is 126.
yield a child transaction
with_transaction_handle(read_only = @read_only, &)
this opens a top level transaction and yields the handle. Use for low level operations