class

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.
Source

Instance methods

close
Source
copy_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.
Source
create_subdir_if_not_exists(path : String, file_permissions)
Source
databases
Source
databases=(databases : Hash(String, Lmdb::Database))
Source
flush(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.
Source
handle
Source
info
  • 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
Source
open_database(database_name : String | Nil = nil, flags = Lmdb::Flags::Database::None)
Source
open_transaction(parent_transaction : Lmdb::Transaction | Nil = nil, read_only = @read_only)
Source
read_only?
Source
set_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.
Source
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.
Source
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().
Source
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.
Source
with_transaction(parent_transaction : Lmdb::Transaction | Nil = nil, read_only = @read_only, &)

yield a child transaction

Source
with_transaction_handle(read_only = @read_only, &)

this opens a top level transaction and yields the handle. Use for low level operations

Source