<code>
tdb = TDB.new("/path/to/file", flags => IO::RDWR|IO::CREAT) tdb.store("HELLO", "world") tdb.fetch("HELLO") -> "world" tdb.delete("HELLO") -> "world"
</code>
Allow transactions to nest
header is big-endian (internal use)
clear database if we are the only one with it open
convert endian (internal use)
just a readability place holder
Disallow transactions to nest
Available hash functions, the key is the name of the hash and the value is a pointer for internal for usage.
Better hashing, but can't be opened by tdb < 1.2.6.
don't store on disk, use in-memory database
don't do any locking
don't use mmap
don't use synchronous transactions
maintain a sequence number
Activate the per-hashchain freelist, default 5
TDB.new("/path/to/file") -> TDB TDB.new("/path/to/file", :hash_size => 666) -> TDB TDB.new("/path/to/file", :hash => :murmur2) -> TDB TDB.new("/path/to/file", :open_flags => IO::RDONLY) -> TDB TDB.new("/path/to/file", :tdb_flags => TDB::NOSYNC) -> TDB source
Initializes a TDB
context. It takes several options.
:hash_size - the number of buckets, this is the most important tuning parameter when creating large databases. This parameter only affects the creation of new databases.
:open_flags - a bit mask of IO flags passed directly to open(2), File.open-compatible flags are accepted.
:hash - any of the hashes described in Hash_Functions. This must remain the same for all clients.
:tdb_flags - a bitmask of any combination of TDB::CLEAR_IF_FIRST
, TDB::INTERNAL
, TDB::NOLOCK
, TDB::NOMMAP
, TDB::CONVERT
, TDB::BIGENDIAN
, TDB::NOSYNC
, TDB::SEQNUM
, TDB::VOLATILE
, TDB::ALLOW_NESTING
, TDB::DISALLOW_NESTING
, TDB::INCOMPATIBLE_HASH
:mode - octal mode mask passed to open(2)
[] (p1) source
[]= (p1, p2) source
clear () source
clears out the database
close () source
closed? () source
delete (*args) source
each () source
fetch (p1, p2 = v2) source
has_key? (p1) source
include? (p1) source
insert (p1, p2) source
insert! (p1, p2) source
key? (p1) source
lockall () source
lockall_mark () source
lockall_read () source
lockall_unmark () source
member? (p1) source
modify (p1, p2) source
modify! (p1, p2) source
nuke! (p1) source
repack () source
repacks a database to reduce fragmentation, available with tdb 1.2.x+
store (p1, p2) source
threadsafe! () source
makes the current TDB
object thread-safe (DANGEROUS) Do not use this method yet, it has problems
threadsafe? () source
will return true when TDB::MT
is included in TDB
or the TDB
object is extended by TDB
trylockall () source
trylockall_read () source
unlockall () source
unlockall_read () source
Included modules: Enumerable
Extended with: TDB::MT
Pages
Classes
Methods
mail archives: https://yhbt.net/ruby-tdb-public/ public: ruby-tdb-public@yhbt.net source code: git clone https://yhbt.net/ruby-tdb.git