Fennel: SegStreamAllocation Class Reference (original) (raw)

SegStreamAllocation is a helper for managing the allocation state of storage created by SegOutputStream when it is used as temp workspace. More...

#include <[SegStreamAllocation.h](SegStreamAllocation%5F8h-source.html)>

Inheritance diagram for SegStreamAllocation:

List of all members.

Public Member Functions
SegStreamAllocation ()
Initialize a SegStreamAllocation in the UNALLOCATED state.
void beginWrite (SharedSegOutputStream pSegOutputStreamInit)
Changes state from UNALLOCATED to WRITING.
void endWrite ()
Changes state from WRITING to READING, or directly to UNALLOCATED if no pages were allocated while in WRITING state.
SharedSegInputStream const & getInputStream () const
**Returns:**reader (only available while in state READING)
BlockNum getWrittenPageCount () const
**Returns:**count of pages which were allocated during WRITING phase (a smaller number may remain allocated since pages are deallocated during READING)
bool isClosed () const
**Returns:**whether the object has been closed
void close ()
Closes this object, releasing any unallocated resources.
Static Public Member Functions
static SharedSegStreamAllocation newSegStreamAllocation ()
Creates a shared pointer to a new SegStreamAllocation, initially in the UNALLOCATED state.
Protected Member Functions
virtual void closeImpl ()
Must be implemented by derived class to release any resources.
Protected Attributes
bool needsClose
Private Attributes
BlockNum nPagesWritten
In state READING, a record of number of pages allocated while in state WRITING.
SharedSegOutputStream pSegOutputStream
Non-singular iff in state WRITING.
SharedSegInputStream pSegInputStream
Non-singular iff in state READING.

Detailed Description

SegStreamAllocation is a helper for managing the allocation state of storage created by SegOutputStream when it is used as temp workspace.

It supports three states:

  1. UNALLOCATED: no segment pages are currently allocated
  2. WRITING: a SegOutputStream is being used to allocate segment pages
  3. READING: a SegInputStream is being used to read and simultaneously deallocate segment pages

Calling close() at any time safely returns it to the UNALLOCATED state.

Version:

Id

//open/dev/fennel/segment/SegStreamAllocation.h#6

Definition at line 51 of file SegStreamAllocation.h.


Constructor & Destructor Documentation

| SegStreamAllocation::SegStreamAllocation | ( | | ) | [explicit] | | ---------------------------------------- | - | | - | ------------ |


Member Function Documentation

| void SegStreamAllocation::closeImpl | ( | | ) | [protected, virtual] | | ----------------------------------- | - | | - | ---------------------- |

| void SegStreamAllocation::endWrite | ( | | ) | | ---------------------------------- | - | | - |

| BlockNum SegStreamAllocation::getWrittenPageCount | ( | | ) | const | | ----------------------------------------------------------------------------------------------------- | - | | - | ----- |

| bool ClosableObject::isClosed | ( | | ) | const [inline, inherited] | | ----------------------------- | - | | - | --------------------------- |

Returns:

whether the object has been closed

Definition at line 58 of file ClosableObject.h.

| void ClosableObject::close | ( | | ) | [inherited] | | -------------------------- | - | | - | ------------- |

Closes this object, releasing any unallocated resources.

Reimplemented in CollectExecStream, CorrelationJoinExecStream, LcsClusterAppendExecStream, and LcsClusterReplaceExecStream.

Definition at line 39 of file ClosableObject.cpp.

References ClosableObject::closeImpl(), and ClosableObject::needsClose.

Referenced by CacheImpl< PageT, VictimPolicyT >::allocatePages(), LcsRowScanBaseExecStream::closeImpl(), ExecStreamGraphImpl::closeImpl(), FlatFileBuffer::open(), ClosableObjectDestructor::operator()(), and Segment::~Segment().


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:46 2009 for Fennel by doxygen 1.5.1