#include <BTreeRecoveryFactory.h>
Inheritance diagram for BTreeRecoveryFactory:
Public Member Functions | |
BTreeRecoveryFactory (SegmentAccessor segmentAccessor, SegmentAccessor scratchAccessor, StoredTypeDescriptorFactory const &typeFactory) | |
virtual SharedLogicalTxnParticipant | loadParticipant (LogicalTxnClassId classId, ByteInputStream &logStream) |
Recovers a LogicalTxnParticipant from the log. | |
Static Public Member Functions | |
static LogicalTxnClassId | getParticipantClassId () |
Private Attributes | |
SegmentAccessor | segmentAccessor |
SegmentAccessor | scratchAccessor |
StoredTypeDescriptorFactory const & | typeFactory |
std::hash_map< PageId, SharedLogicalTxnParticipant > | writerMap |
Definition at line 41 of file BTreeRecoveryFactory.h.
BTreeRecoveryFactory::BTreeRecoveryFactory | ( | SegmentAccessor | segmentAccessor, | |
SegmentAccessor | scratchAccessor, | |||
StoredTypeDescriptorFactory const & | typeFactory | |||
) | [explicit] |
Definition at line 32 of file BTreeRecoveryFactory.cpp.
00036 : segmentAccessor(segmentAccessortInit), 00037 scratchAccessor(scratchAccessortInit), 00038 typeFactory(typeFactoryInit) 00039 { 00040 }
SharedLogicalTxnParticipant BTreeRecoveryFactory::loadParticipant | ( | LogicalTxnClassId | classId, | |
ByteInputStream & | logStream | |||
) | [virtual] |
Recovers a LogicalTxnParticipant from the log.
Using the classId to determine the participant type to create, the factory reads required constructor parameters from the log input stream. The factory may peool participant instances; i.e. when the same constructor parameters are encountered a second time, the factory can return the same instance. (TODO: refine this when parallelized recovery is implemented.) The implementation must consume ALL log data for this record, even if some of it turns out to be unneeded.
classId | the LogicalTxnClassId recorded when the participant was logged while online | |
logStream | the log information written by the participant's describeParticipant() implementation |
Implements LogicalTxnParticipantFactory.
Definition at line 42 of file BTreeRecoveryFactory.cpp.
References getParticipantClassId(), BTreeDescriptor::keyProjection, TupleProjection::readPersistent(), TupleDescriptor::readPersistent(), ByteInputStream::readValue(), BTreeDescriptor::rootPageId, scratchAccessor, segmentAccessor, BTreeDescriptor::segmentAccessor, BTreeDescriptor::tupleDescriptor, typeFactory, and writerMap.
00045 { 00046 assert(classId == getParticipantClassId()); 00047 BTreeDescriptor descriptor; 00048 logStream.readValue(descriptor.rootPageId); 00049 descriptor.segmentAccessor = segmentAccessor; 00050 descriptor.tupleDescriptor.readPersistent(logStream,typeFactory); 00051 descriptor.keyProjection.readPersistent(logStream); 00052 00053 SharedLogicalTxnParticipant pParticipant = writerMap[descriptor.rootPageId]; 00054 if (pParticipant) { 00055 return pParticipant; 00056 } 00057 00058 pParticipant = SharedBTreeWriter( 00059 new BTreeWriter( 00060 descriptor,scratchAccessor)); 00061 00062 writerMap[descriptor.rootPageId] = pParticipant; 00063 00064 return pParticipant; 00065 }
LogicalTxnClassId BTreeRecoveryFactory::getParticipantClassId | ( | ) | [static] |
Definition at line 67 of file BTreeRecoveryFactory.cpp.
Referenced by BTreeWriter::getParticipantClassId(), and loadParticipant().
StoredTypeDescriptorFactory const& BTreeRecoveryFactory::typeFactory [private] |
std::hash_map<PageId,SharedLogicalTxnParticipant> BTreeRecoveryFactory::writerMap [private] |