BlockFile

Block file operation

@safe
class BlockFile {}

Constructors

this
this()
Undocumented in source.
this
this(string filename, uint SIZE, Flag!"read_only" read_only)
Undocumented in source.
this
this(File file, uint SIZE, Flag!"read_only" read_only)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

BlockFileStatistic
alias BlockFileStatistic = Statistic!(ulong, Yes.histogram)
Undocumented in source.
RecyclerFileStatistic
alias RecyclerFileStatistic = Statistic!(ulong, Yes.histogram)
Undocumented in source.

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

cache_empty
bool cache_empty()
Undocumented in source. Be warned that the author may not have intended to support it.
cache_len
const(size_t) cache_len()
Undocumented in source. Be warned that the author may not have intended to support it.
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 debuging only to dump the Block's

empty
bool empty()
Undocumented in source. Be warned that the author may not have intended to support it.
hasHeader
bool hasHeader()
headerBlock
const(HeaderBlock) headerBlock()
Undocumented in source. Be warned that the author may not have intended to support it.
index_to_seek
ulong index_to_seek(Index index)
lastBlockIndex
Index lastBlockIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
load
const(Document) load(Index index)

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

load
T load(Index index)
Undocumented in source. Be warned that the author may not have intended to support it.
masterBlock
const(MasterBlock) masterBlock()
Undocumented in source. Be warned that the author may not have intended to support it.
numberOfBlocks
ulong numberOfBlocks(ulong size)
opSlice
BlockSegmentRange opSlice()
Undocumented in source. Be warned that the author may not have intended to support it.
opSlice
BlockSegmentRange opSlice(I from, I to)
Undocumented in source. Be warned that the author may not have intended to support it.
readInitial
void readInitial()
Undocumented in source. Be warned that the author may not have intended to support it.
recycleDump
void recycleDump(File fout)
Undocumented in source. Be warned that the author may not have intended to support it.
recycleStatisticDump
void recycleStatisticDump(File fout, bool logscale)
Undocumented in source. Be warned that the author may not have intended to support it.
recyclerStatistic
const(RecyclerFileStatistic) recyclerStatistic()
Undocumented in source. Be warned that the author may not have intended to support it.
root_index
void root_index(Index index)

Sets the database root index

root_index
Index root_index()
Undocumented in source. Be warned that the author may not have intended to support it.
save
const(BlockSegment*) save(const(Document) doc)
const(BlockSegment*) save(T rec)

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

seek
void seek(Index index)

Sets the pointer to the index in the blockfile.

statistic
const(BlockFileStatistic) statistic()
Undocumented in source. Be warned that the author may not have intended to support it.
statisticDump
void statisticDump(File fout, bool logscale)
Undocumented in source. Be warned that the author may not have intended to support it.
store
void store()

This function will erase, write, update the BlockFile and update the recyle 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

writeRecyclerStatistic
void writeRecyclerStatistic()
Undocumented in source. Be warned that the author may not have intended to support it.
writeStatistic
void writeStatistic()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

DEFAULT_BLOCK_SIZE
enum DEFAULT_BLOCK_SIZE;
Undocumented in source.
FILE_LABEL
enum FILE_LABEL;
Undocumented in source.

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

reset
BlockFile reset(string filename)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

do_not_write
bool do_not_write;
Undocumented in source.

Structs

BlockSegmentRange
struct BlockSegmentRange
Undocumented in source.
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

Variables

BLOCK_SIZE
uint BLOCK_SIZE;
Undocumented in source.
_last_block_index
Index _last_block_index;
Undocumented in source.
_recycler_statistic
RecyclerFileStatistic _recycler_statistic;
Undocumented in source.
_statistic
BlockFileStatistic _statistic;
Undocumented in source.
block_chains
BlockChain block_chains;
Undocumented in source.
file
File file;
Undocumented in source.
headerblock
HeaderBlock headerblock;
Undocumented in source.
masterblock
MasterBlock masterblock;
Undocumented in source.
read_only
Flag!"read_only" read_only;
Undocumented in source.
recycler
Recycler recycler;
Undocumented in source.

Meta