An iterator object keeping track of a write in progress to a CompressedVectorNode. More...
An iterator object keeping track of a write in progress to a CompressedVectorNode.
A CompressedVectorWriter object is a block iterator that reads blocks of records from memory and stores them in a CompressedVectorNode. Blocks of records are processed rather than a single record-at-a-time for efficiency reasons. The CompressedVectorWriter class encapsulates all the state that must be saved in between the processing of one record block and the next (e.g. partially written disk pages, partially filled bytes in a bytestream, or data compression state). New memory buffers can be used for each record block write, or the previous buffers can be reused.
CompressedVectorWriter objects have an open/closed state. Initially a newly created CompressedVectorWriter is in the open state. After the API user calls CompressedVectorWriter::close, the object will be in the closed state and no more data transfers will be possible.
There is no CompressedVectorWriter constructor in the API. The function CompressedVectorNode::writer returns an already constructed CompressedVectorWriter object with given memory buffers (SourceDestBuffers) already associated. CompressedVectorWriter::close must explicitly be called to safely and gracefully end the transfer.
Warning: If CompressedVectorWriter::close is not called before the CompressedVectorWriter destructor is invoked, all writes to the CompressedVectorNode will be lost (it will have zero children).
A class invariant is a list of statements about an object that are always true before and after any operation on the object. An invariant is useful for testing correct operation of an implementation. Statements in an invariant can involve only externally visible state, or can refer to internal implementation-specific state that is not visible to the API user. The following C++ code checks externally visible state for consistency and throws an exception if the invariant is violated: