Extracted from Pike v7.6 release 61 at 2005-12-30.
pike.ida.liu.se
[Top]
Mird
Mird.Mird

Method Mird.Mird()->create()


Method create

void Mird.Mird(string filename, void|mapping options)

Description

Opens the database using the given filename. Note that the file filename +".journal" will be created too.

Possible options:

"flags" : string

Database flags, see below.

"block_size" : int

Database block size; must be even 2^n. Database size is limited to 2^32 blocks, ie block_size*2^32 (8192*2^(32-5) is approximately 1Tb) (2048)

"frag_bits" : int

This sets the number of fragments in a fragmented block, and address bits to locate them. The number of fragments in a fragmented block is equal to 2^frag_bits-1, by default 2^5-1=32-1=31.

This steals bits from the 32 bit address used to point out a chunk. (5)

"hashtrie_bits" : int

This is the number of bits in each hash-trie hash; 4*2^n must be a lot less than block_size. (5)

"cache_size" : int

This is the number of blocks cached from the database; this is used for both the read- and the write cache. Note that the memory usage is constant, approximately block_size*cache_size bytes. (32)

"cache_search_length" : int

This is the closed hash maximum search length to find a block in the cache; note that this will result in linear time usage. (8)

"max_free_frag_blocks" : int

This is how many blocks with free space that is kept in a list to be used when a transaction is running. The closest fit of usage of these blocks are where the data will be stored. (10)

"file_mode" : int

This is the default mode the files are opened with; although affected by UMASK (0666)

"journal_readback_n" : int

This is how many journal entries are read back at once at transaction finish, cancel or copy time. Bytes needed is approximately 24*this number (200)


"flags" is a string with any of these characters:

'r'

Readonly.

'R'

Readonly in a live system (one process writes, many reads).

'n'

Don't create if it doesn't exist.

'x'

Exclusive (always create).

's'

Call fsync(3) when finishing transactions.

'S'

Call sync(2) after fsync(3).

'j'

Complain if journal file is gone missing.