Fennel: SegmentFactory Class Reference (original) (raw)
SegmentFactory is a factory class for creating instances of the Segment interface. More...
#include <[SegmentFactory.h](SegmentFactory%5F8h-source.html)>
Detailed Description
SegmentFactory is a factory class for creating instances of the Segment interface.
See the design docs for more detail.
Definition at line 49 of file SegmentFactory.h.
Constructor & Destructor Documentation
| SegmentFactory::~SegmentFactory | ( | | ) | [virtual] | | -------------------------------- | - | | - | ----------- |
Member Function Documentation
| DeviceId SegmentFactory::allocateTempDeviceId | ( | | ) | [private] | | --------------------------------------------- | - | | - | ----------- |
| void SegmentFactory::deallocateTempDeviceId | ( | DeviceId | | ) | [private] | | ------------------------------------------- | - | -------- | | - | ----------- |
| ConfigMap const & SegmentFactory::getConfigMap | ( | | ) | const | | --------------------------------------------------------------------- | - | | - | ----- |
Opens a RandomAllocationSegment.
Parameters:
| delegateSegment | the underlying segment providing storage; this segment must return LINEAR_ALLOCATION from getAllocationOrder(), and should already be allocated to the desired size |
|---|---|
| bFormat | if true, the RandomAllocationSegment is formatted as empty; otherwise, the existing formatting is read |
| deferInit | if true, defer initialization on the segment; defaults to false |
Returns:
new segment
Definition at line 87 of file SegmentFactory.cpp.
References newTracingSegment(), and NULL_PAGE_ID.
Opens a VersionedRandomAllocationSegment.
Parameters:
| delegateSegment | the underlying segment providing storage; this segment must return LINEAR_ALLOCATION from getAllocationOrder(), and should already be allocated to the desired size |
|---|---|
| pTempSegment | the temporary segment used to store modifications to allocation node pages |
| bFormat | if true, the VersionedRandomAllocationSegment is formatted as empty; otherwise, the existing formatting is read |
| deferInit | if true, defer initialization on the segment; defaults to false |
Returns:
new segment
Definition at line 108 of file SegmentFactory.cpp.
References newTracingSegment(), and NULL_PAGE_ID.
Opens a new SnapshotRandomAllocationSegment.
Parameters:
| delegateSegment | the underlying segment providing storage; most likely, this is the same as the versionedSegment |
|---|---|
| versionedSegment | the underlying segment that provides versioning of pages |
| snapshotCsn | the commit sequence number associated with the segment that determines which pages to read |
| readOnlyCommittedData | if true, read only committed data, even ignoring uncommitted data created by the current transaction; defaults to false |
Returns:
new segment
Definition at line 130 of file SegmentFactory.cpp.
References newTracingSegment().
Opens a WALSegment.
Parameters:
| logSegment | the Segment in which log pages are stored; this segment must guarantee at least ASCENDING_ALLOCATION (TBD: plus some other restrictions on the way in which page allocation is implemented) |
|---|
Returns:
new segment
Definition at line 161 of file SegmentFactory.cpp.
References newTracingSegment().
Opens a CircularSegment.
Parameters:
| delegateSegment | the underlying segment |
|---|---|
| pCheckpointProvider | the CheckpointProvider to call when segment space is getting low; if this is singular, the caller must take care of checkpointing to prevent space from running out |
| oldestPageId | restored oldest PageId for recovery, or NULL_PAGE_ID for empty segment |
| newestPageId | restored newest PageId for recovery, or NULL_PAGE_ID for empty segment or unknown |
Returns:
new segment
Definition at line 215 of file SegmentFactory.cpp.
References newTracingSegment().
Opens a VersionedSegment.
Parameters:
| dataSegment | the segment storing the latest page versions |
|---|---|
| logSegment | the log segment used for storing old page versions; an assertion violation will result if this is not an instance of WALSegment |
| versionNumber | TODO: doc |
| onlineUuid | TODO: doc |
Returns:
new segment
Definition at line 186 of file SegmentFactory.cpp.
References newTracingSegment().
If necessary, wraps a TracingSegment around another segment.
Parameters:
| pSegment | the underlying segment |
|---|---|
| sourceName | the trace source name for this segment |
| qualifySourceName | if true, pSegment's pointer address is appended to sourceName to make it unique |
Returns:
the wrapped segment
Definition at line 233 of file SegmentFactory.cpp.
References pTraceTarget, and TRACE_FINE.
Referenced by newCircularSegment(), newDynamicDelegatingSegment(), newLinearDeviceSegment(), newLinearViewSegment(), newRandomAllocationSegment(), newScratchSegment(), newSnapshotRandomAllocationSegment(), newTempDeviceSegment(), newVersionedRandomAllocationSegment(), newVersionedSegment(), and newWALSegment().
Creates a new temporary device paired with a LinearDeviceSegment.
The device will be automatically deleted when the segment is destroyed.
Parameters:
| pCache | the cache to use for this segment |
|---|---|
| deviceMode | mode in which to open the device |
| deviceFileName | filename to use for device; if relative, location is dependent on SegmentFactory configuration parameters |
Returns:
new segment
Definition at line 260 of file SegmentFactory.cpp.
References allocateTempDeviceId(), DeviceMode::create, LinearDeviceSegmentParams::firstBlockId, MAXU, newTracingSegment(), LinearDeviceSegmentParams::nPagesAllocated, FileSystem::remove(), CompoundId::setBlockNum(), CompoundId::setDeviceId(), and TempSegDestructor.
template
| static PDerivedSegment SegmentFactory::dynamicCast | ( | SharedSegment | pSegment | ) | [inline, static] |
|---|
Some implementations of the Segment interface extend the interface with implementation-specific features.
dynamicCast provides access to a derived interface from the generic SharedSegment. It is the caller's responsibility to ensure that the returned (non-shared) pointer remains protected by the original shared_ptr. All generic access to the segment should still go through the original SharedSegment for proper tracing.
Example usage given a SharedSegment pSegment:
[VersionedSegment](classVersionedSegment.html) *pVersionedSegment = SegmentFactory::dynamicCast<VersionedSegment *>(pSegment);
Parameters:
| pSegment | the SharedSegment to downcast |
|---|
Returns:
result of the downcast as a reference, or NULL if pSegment was singular or of a different type
Definition at line 336 of file SegmentFactory.h.
References DelegatingSegment::getDelegateSegment().
00337 { 00338 PDerivedSegment pDerived = dynamic_cast( 00339 pSegment.get()); 00340 if (pDerived) { 00341 return pDerived; 00342 } 00343 TracingSegment *pTracing = dynamic_cast<TracingSegment *>( 00344 pSegment.get()); 00345 if (pTracing) { 00346 pDerived = dynamic_cast( 00347 pTracing->getDelegateSegment().get()); 00348 } 00349 return pDerived; 00350 }
Friends And Related Function Documentation
Member Data Documentation
The documentation for this class was generated from the following files:
- /home/pub/open/dev/fennel/segment/SegmentFactory.h
- /home/pub/open/dev/fennel/segment/SegmentFactory.cpp
