Hash_Functions LICENSE NEWS README TODO
TDB ERR MT

Methods

::new #[] #[]= #clear #close #closed? #delete #each #fetch #has_key? #include? #insert #insert! #key? #lockall #lockall_mark #lockall_read #lockall_unmark #member? #modify #modify! #nuke! #repack #store #threadsafe! #threadsafe? #trylockall #trylockall_read #unlockall #unlockall_read

class TDB

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

Constants

ALLOW_NESTING

Allow transactions to nest

BIGENDIAN

header is big-endian (internal use)

CLEAR_IF_FIRST

clear database if we are the only one with it open

CONVERT

convert endian (internal use)

DEFAULT

just a readability place holder

DISALLOW_NESTING

Disallow transactions to nest

HASHES

Available hash functions, the key is the name of the hash and the value is a pointer for internal for usage.

INCOMPATIBLE_HASH

Better hashing, but can't be opened by tdb < 1.2.6.

INTERNAL

don't store on disk, use in-memory database

NOLOCK

don't do any locking

NOMMAP

don't use mmap

NOSYNC

don't use synchronous transactions

SEQNUM

maintain a sequence number

VOLATILE

Activate the per-hashchain freelist, default 5

Public Class Methods

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)

Public Instance Methods

[] (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://bogomips.org/ruby-tdb-public/
public: ruby-tdb-public@bogomips.org