BlockFile

Block file operation

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

cacheLoad
Document cacheLoad(Index index)

Works the same as load except that it also reads data from cache which hasn't been stored yet

cacheLoad
T cacheLoad(Index index)

Ditto

claim
Index claim(size_t size)

Internal function used to reserve a size bytes in the blockfile

close
void close()
createHeader
void createHeader(string name, string file_label, uint max_size)

Creates the header block.

dispose
void dispose(Index index)

Marks a block for the recycler as erased This function ereases the block before the store method is called The list of recyclable blocks is also updated after the store method has been called.

dump
void dump(uint segments_per_line, Index from, Index to, File fout)

Used for debugging only to dump the Block's

hasHeader
bool hasHeader()
index_to_seek
ulong index_to_seek(Index index)
load
const(Document) load(Index index)

Loads a document at an index. If the document is not valid it throws an exception.

numberOfBlocks
ulong numberOfBlocks(ulong size)
root_index
void root_index(Index index)

Sets the database root index

save
const(BlockSegment*) save(T rec)

Allocates new document Does not actually update the BlockFile just reserves new block's

save
const(BlockSegment*) save(const(Document) doc)

Allocates new document Does not actually update the BlockFile just reserves new block's

seek
void seek(Index index)

Sets the pointer to the index in the blockfile.

store
void store()

This function will erase, write, update the BlockFile and update the recycle bin Stores the list of BlockSegment to the disk If this function throws an Exception the Blockfile has not been updated

writeMasterBlock
void writeMasterBlock()

Write the master block to the filesystem and truncate the file

Static functions

create
void create(string filename, string description, uint BLOCK_SIZE, string file_label, uint max_size)

Creates an empty BlockFile

opCall
BlockFile opCall(string filename, Flag!"read_only" read_only)

Opens an existing file which previously was created by BlockFile.create

Structs

HeaderBlock
struct HeaderBlock

* The HeaderBlock is the first block in the BlockFile

MasterBlock
struct MasterBlock

The MasterBlock is the last block in the BlockFile This block maintains the indices to of other block