#include <ExecStreamBufAccessor.h>
Public Member Functions | |
ExecStreamBufAccessor () | |
virtual | ~ExecStreamBufAccessor () |
void | setProvision (ExecStreamBufProvision provision) |
Initializes the buffer provision mode of this accessor. | |
void | setTupleShape (TupleDescriptor const &tupleDesc, TupleFormat tupleFormat=TUPLE_FORMAT_STANDARD) |
Initializes the shape for tuples to be accessed. | |
void | clear () |
Initializes this accessor to the idle unprovided state. | |
void | provideBufferForProduction (PBuffer pStart, PBuffer pEnd, bool reusable) |
Provides empty buffer space into which producers will write data; called by consumer. | |
void | provideBufferForConsumption (PConstBuffer pStart, PConstBuffer pEnd) |
Provides a buffer full of data which consumers will read; called by producer. | |
void | requestProduction () |
Requests production of data; called by consumer when it exhausts existing data and needs more in order to make progress. | |
void | requestConsumption () |
Requests consumption of data; called by producer when it exhausts existing buffer space and needs more in order to make progress. | |
bool | isProductionPossible () const |
| |
bool | isConsumptionPossible () const |
| |
bool | demandData () |
Tests whether immediate consumption is possible. | |
void | markEOS () |
Marks end of stream; called by producer when it knows it will not be producing any more data. | |
void | produceData (PBuffer pEnd) |
Indicates amount of data that has been written into buffer; called by producer. | |
void | consumeData (PConstBuffer pEnd) |
Indicates amount of data that has been read from buffer; called by consumer. | |
PConstBuffer | getConsumptionStart () const |
Accesses start of buffer to be consumed; called by consumer. | |
PConstBuffer | getConsumptionEnd () const |
Accesses end of buffer to be consumed; called by consumer. | |
uint | getConsumptionAvailable () const |
Computes the number of contiguous bytes available to be consumed from this buffer. | |
uint | getConsumptionAvailableBounded (uint cbLimit) |
Computes the largest number of contiguous bytes available to be consumed from this buffer, given the constraints that (a) the number of bytes must not be greater than cbLimit, and (b) partial tuples are not allowed. | |
uint | getConsumptionTuplesAvailable () |
Computes the number of tuples available to be consumed from this buffer. | |
PConstBuffer | spanWholeTuples (PConstBuffer start, uint size) |
Spans as many tuples as can be consumed from this buffer and will fit into a buffer of given size. | |
PBuffer | getProductionStart () const |
Accesses start of buffer into which data should be produced; called by producer. | |
PBuffer | getProductionEnd () const |
Accesses end of buffer into which data should be produced; called by producer. | |
uint | getProductionAvailable () const |
Computes the number of contiguous bytes of buffer space available for producing data into this buffer. | |
ExecStreamBufState | getState () const |
Retrieves the state of this accessor. | |
bool | hasPendingEOS () const |
Retrieves the pending-end-of-stream flag. | |
ExecStreamBufProvision | getProvision () const |
Retrieves the buffer provision mode of this accessor. | |
TupleDescriptor const & | getTupleDesc () const |
Retrieves the descriptor for tuples being accessed. | |
TupleFormat | getTupleFormat () const |
Retrieves the format for tuples being accessed. | |
void | validateTupleSize (TupleData const &tupleData) |
Validates the size of a tuple, throwing a TupleOverflowExcn if it is bigger than the maximum buffer size. | |
bool | produceTuple (TupleData const &tupleData) |
Attempts to marshal a tuple into the production buffer, placing the first byte at getProductionStart(). | |
TupleAccessor & | accessConsumptionTuple () |
Accesses a tuple from getConsumptionStart() but does not unmarshal it or consume it. | |
void | unmarshalTuple (TupleData &tupleData, uint iFirstDatum=0) |
Unmarshals a tuple from getConsumptionStart() but does not consume it. | |
void | consumeTuple () |
Consumes last tuple accessed via accessConsumptionTuple() or unmarshalTuple(). | |
bool | isTupleConsumptionPending () const |
| |
TupleAccessor & | getConsumptionTupleAccessor () |
| |
TupleAccessor & | getScratchTupleAccessor () |
| |
void | bindProjection (TupleProjection const &inputProj) |
Binds projection accessor to the input tuple accessor. | |
void | unmarshalProjectedTuple (TupleData &projTupleData) |
Unmarshals projected tuple from input stream. | |
Private Member Functions | |
void | setEOS () |
sets state to EXECBUF_EOS | |
Private Attributes | |
PBuffer | pBufStart |
PBuffer | pBufEnd |
PBuffer | pProducer |
PBuffer | pConsumer |
ExecStreamBufProvision | provision |
ExecStreamBufState | state |
bool | pendingEOS |
TupleDescriptor | tupleDesc |
TupleFormat | tupleFormat |
TupleAccessor | tupleProductionAccessor |
TupleAccessor | tupleConsumptionAccessor |
TupleProjectionAccessor | tupleProjectionAccessor |
uint | cbBuffer |
For more information, see SchedulerDesign.
Definition at line 45 of file ExecStreamBufAccessor.h.
ExecStreamBufAccessor::ExecStreamBufAccessor | ( | ) | [inline, explicit] |
Definition at line 395 of file ExecStreamBufAccessor.h.
References BUFPROV_NONE, cbBuffer, clear(), EXECBUF_EOS, provision, state, TUPLE_FORMAT_STANDARD, and tupleFormat.
00396 { 00397 clear(); 00398 provision = BUFPROV_NONE; 00399 state = EXECBUF_EOS; 00400 tupleFormat = TUPLE_FORMAT_STANDARD; 00401 cbBuffer = 0; 00402 }
virtual ExecStreamBufAccessor::~ExecStreamBufAccessor | ( | ) | [inline, virtual] |
void ExecStreamBufAccessor::setEOS | ( | ) | [inline, private] |
sets state to EXECBUF_EOS
Definition at line 503 of file ExecStreamBufAccessor.h.
References clear(), EXECBUF_EOS, pConsumer, pProducer, and state.
Referenced by consumeData(), and markEOS().
00504 { 00505 assert(pProducer == pConsumer); 00506 clear(); 00507 state = EXECBUF_EOS; 00508 }
void ExecStreamBufAccessor::setProvision | ( | ExecStreamBufProvision | provision | ) | [inline] |
Initializes the buffer provision mode of this accessor.
provision | new provision mode |
Definition at line 414 of file ExecStreamBufAccessor.h.
References BUFPROV_NONE, and provision.
Referenced by JavaSinkExecStream::stuffByteBuffer().
00416 { 00417 assert(provision == BUFPROV_NONE); 00418 provision = provisionInit; 00419 }
void ExecStreamBufAccessor::setTupleShape | ( | TupleDescriptor const & | tupleDesc, | |
TupleFormat | tupleFormat = TUPLE_FORMAT_STANDARD | |||
) | [inline] |
Initializes the shape for tuples to be accessed.
tupleDesc | logical descriptor for tuples | |
tupleFormat | physical layout for tuples |
Definition at line 421 of file ExecStreamBufAccessor.h.
References TupleAccessor::compute(), tupleConsumptionAccessor, tupleDesc, tupleFormat, and tupleProductionAccessor.
Referenced by JavaSinkExecStream::stuffByteBuffer().
00424 { 00425 tupleDesc = tupleDescInit; 00426 tupleFormat = tupleFormatInit; 00427 tupleProductionAccessor.compute(tupleDesc, tupleFormat); 00428 tupleConsumptionAccessor.compute(tupleDesc, tupleFormat); 00429 }
void ExecStreamBufAccessor::clear | ( | ) | [inline] |
Initializes this accessor to the idle unprovided state.
Definition at line 431 of file ExecStreamBufAccessor.h.
References cbBuffer, EXECBUF_EMPTY, pBufEnd, pBufStart, pConsumer, pendingEOS, pProducer, TupleAccessor::resetCurrentTupleBuf(), state, tupleConsumptionAccessor, and tupleProductionAccessor.
Referenced by ExecStreamBufAccessor(), ExecStreamGraphImpl::open(), setEOS(), and JavaSinkExecStream::stuffByteBuffer().
00432 { 00433 pBufStart = NULL; 00434 pBufEnd = NULL; 00435 pProducer = NULL; 00436 pConsumer = NULL; 00437 cbBuffer = 0; 00438 state = EXECBUF_EMPTY; 00439 pendingEOS = false; 00440 tupleProductionAccessor.resetCurrentTupleBuf(); 00441 tupleConsumptionAccessor.resetCurrentTupleBuf(); 00442 }
void ExecStreamBufAccessor::provideBufferForProduction | ( | PBuffer | pStart, | |
PBuffer | pEnd, | |||
bool | reusable | |||
) | [inline] |
Provides empty buffer space into which producers will write data; called by consumer.
pStart | first byte of empty buffer | |
pEnd | end of empty buffer | |
reusable | whether the buffer can be reused after it is consumed |
Definition at line 444 of file ExecStreamBufAccessor.h.
References BUFPROV_CONSUMER, cbBuffer, EXECBUF_EMPTY, EXECBUF_UNDERFLOW, pBufEnd, pBufStart, pConsumer, pProducer, provision, and state.
00448 { 00449 assert((state == EXECBUF_UNDERFLOW) || (state == EXECBUF_EMPTY)); 00450 assert(provision == BUFPROV_CONSUMER); 00451 pBufStart = pStart; 00452 pBufEnd = pEnd; 00453 pProducer = pStart; 00454 pConsumer = pStart; 00455 cbBuffer = pEnd - pStart; 00456 state = EXECBUF_UNDERFLOW; 00457 00458 if (!reusable) { 00459 // indicate that this buffer is not reusable 00460 pBufStart = NULL; 00461 } 00462 }
void ExecStreamBufAccessor::provideBufferForConsumption | ( | PConstBuffer | pStart, | |
PConstBuffer | pEnd | |||
) | [inline] |
Provides a buffer full of data which consumers will read; called by producer.
pStart | first byte of data buffer | |
pEnd | end of data buffer |
Definition at line 464 of file ExecStreamBufAccessor.h.
References BUFPROV_PRODUCER, EXECBUF_EMPTY, EXECBUF_OVERFLOW, EXECBUF_UNDERFLOW, pBufEnd, pBufStart, pConsumer, pProducer, provision, and state.
Referenced by JavaSinkExecStream::stuffByteBuffer().
00467 { 00468 assert((state == EXECBUF_UNDERFLOW) || (state == EXECBUF_EMPTY)); 00469 assert(provision == BUFPROV_PRODUCER); 00470 pBufStart = const_cast<PBuffer>(pStart); 00471 pBufEnd = const_cast<PBuffer>(pEnd); 00472 pConsumer = pBufStart; 00473 pProducer = pBufEnd; 00474 state = EXECBUF_OVERFLOW; 00475 00476 // indicate that this buffer is not reusable 00477 pBufStart = NULL; 00478 }
void ExecStreamBufAccessor::requestProduction | ( | ) | [inline] |
Requests production of data; called by consumer when it exhausts existing data and needs more in order to make progress.
Definition at line 480 of file ExecStreamBufAccessor.h.
References EXECBUF_EMPTY, EXECBUF_UNDERFLOW, pBufStart, pConsumer, pProducer, and state.
Referenced by demandData(), MockConsumerExecStream::execute(), ParallelExecStreamScheduler::readStream(), and ParallelExecStreamScheduler::start().
00481 { 00482 assert((state == EXECBUF_UNDERFLOW) || (state == EXECBUF_EMPTY)); 00483 state = EXECBUF_UNDERFLOW; 00484 pProducer = pBufStart; 00485 pConsumer = pBufStart; 00486 }
void ExecStreamBufAccessor::requestConsumption | ( | ) | [inline] |
Requests consumption of data; called by producer when it exhausts existing buffer space and needs more in order to make progress.
Definition at line 488 of file ExecStreamBufAccessor.h.
References EXECBUF_NONEMPTY, EXECBUF_OVERFLOW, and state.
Referenced by ExternalSortOutput::fetch(), and produceTuple().
00489 { 00490 assert((state == EXECBUF_OVERFLOW) || (state == EXECBUF_NONEMPTY)); 00491 state = EXECBUF_OVERFLOW; 00492 }
bool ExecStreamBufAccessor::isProductionPossible | ( | ) | const [inline] |
Definition at line 404 of file ExecStreamBufAccessor.h.
References EXECBUF_EOS, EXECBUF_OVERFLOW, pendingEOS, and state.
Referenced by produceData().
00405 { 00406 return !pendingEOS && (state != EXECBUF_EOS) && (state != EXECBUF_OVERFLOW); 00407 }
bool ExecStreamBufAccessor::isConsumptionPossible | ( | ) | const [inline] |
Definition at line 409 of file ExecStreamBufAccessor.h.
References EXECBUF_NONEMPTY, EXECBUF_OVERFLOW, and state.
Referenced by accessConsumptionTuple(), consumeData(), demandData(), MockConsumerExecStream::execute(), Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch(), and markEOS().
00410 { 00411 return (state == EXECBUF_OVERFLOW) || (state == EXECBUF_NONEMPTY); 00412 }
bool ExecStreamBufAccessor::demandData | ( | ) | [inline] |
Tests whether immediate consumption is possible.
If it is not, calls requestProduction(), except in state EXECBUF_EOS.
Definition at line 713 of file ExecStreamBufAccessor.h.
References EXECBUF_EOS, isConsumptionPossible(), requestProduction(), and state.
Referenced by FtrsTableWriter::execute(), MockConsumerExecStream::execute(), and ExternalSortRunLoader::loadRun().
00714 { 00715 if (state == EXECBUF_EOS) { 00716 return false; 00717 } else if (isConsumptionPossible()) { 00718 return true; 00719 } else { 00720 requestProduction(); 00721 return false; 00722 } 00723 }
void ExecStreamBufAccessor::markEOS | ( | ) | [inline] |
Marks end of stream; called by producer when it knows it will not be producing any more data.
The state changes to EXECBUF_EOS as soon as there remains no more data to be consumed
Definition at line 494 of file ExecStreamBufAccessor.h.
References isConsumptionPossible(), pendingEOS, and setEOS().
00495 { 00496 if (isConsumptionPossible()) { 00497 pendingEOS = true; 00498 return; 00499 } 00500 setEOS(); 00501 }
void ExecStreamBufAccessor::produceData | ( | PBuffer | pEnd | ) | [inline] |
Indicates amount of data that has been written into buffer; called by producer.
The usual sequence is
pEnd | end of data produced (between getProductionStart() and getProductionEnd()) |
Definition at line 605 of file ExecStreamBufAccessor.h.
References EXECBUF_NONEMPTY, getProductionEnd(), getProductionStart(), isProductionPossible(), pProducer, and state.
Referenced by produceTuple().
00606 { 00607 assert(isProductionPossible()); 00608 assert(pEnd > getProductionStart()); 00609 assert(pEnd <= getProductionEnd()); 00610 pProducer = pEnd; 00611 state = EXECBUF_NONEMPTY; 00612 }
void ExecStreamBufAccessor::consumeData | ( | PConstBuffer | pEnd | ) | [inline] |
Indicates amount of data that has been read from buffer; called by consumer.
The usual sequence is
pEnd | end of data consumed (between getConsumptionStart() and getConsumptionEnd()) |
Definition at line 614 of file ExecStreamBufAccessor.h.
References EXECBUF_EMPTY, EXECBUF_NONEMPTY, getConsumptionEnd(), getConsumptionStart(), isConsumptionPossible(), pConsumer, pendingEOS, setEOS(), and state.
Referenced by consumeTuple(), JavaSinkExecStream::execute(), Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch(), and ExternalSortRunLoader::loadRun().
00615 { 00616 assert(isConsumptionPossible()); 00617 assert(pEnd > getConsumptionStart()); 00618 assert(pEnd <= getConsumptionEnd()); 00619 pConsumer = const_cast<PBuffer>(pEnd); 00620 if (pConsumer == getConsumptionEnd()) { 00621 if (pendingEOS) { 00622 setEOS(); 00623 } else { 00624 state = EXECBUF_EMPTY; 00625 } 00626 } else { 00627 // NOTE jvs 9-Nov-2004: this is misleading until circular buffering 00628 // gets implemented, but it isn't incorrect either 00629 state = EXECBUF_NONEMPTY; 00630 } 00631 }
PConstBuffer ExecStreamBufAccessor::getConsumptionStart | ( | ) | const [inline] |
Accesses start of buffer to be consumed; called by consumer.
Definition at line 510 of file ExecStreamBufAccessor.h.
References pConsumer.
Referenced by accessConsumptionTuple(), consumeData(), consumeTuple(), JavaSinkExecStream::execute(), getConsumptionAvailable(), getConsumptionAvailableBounded(), getConsumptionTuplesAvailable(), Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch(), ExternalSortRunLoader::loadRun(), and ExecStreamScheduler::traceStreamBufferContents().
00511 { 00512 return pConsumer; 00513 }
PConstBuffer ExecStreamBufAccessor::getConsumptionEnd | ( | ) | const [inline] |
Accesses end of buffer to be consumed; called by consumer.
Definition at line 515 of file ExecStreamBufAccessor.h.
References pProducer.
Referenced by consumeData(), JavaSinkExecStream::execute(), getConsumptionAvailable(), getConsumptionTuplesAvailable(), and ExecStreamScheduler::traceStreamBufferContents().
00516 { 00517 return pProducer; 00518 }
uint ExecStreamBufAccessor::getConsumptionAvailable | ( | ) | const [inline] |
Computes the number of contiguous bytes available to be consumed from this buffer.
Definition at line 520 of file ExecStreamBufAccessor.h.
References getConsumptionEnd(), and getConsumptionStart().
Referenced by JavaSinkExecStream::execute(), getConsumptionAvailableBounded(), ExternalSortRunLoader::loadRun(), and ExecStreamScheduler::traceStreamBuffers().
00521 { 00522 return getConsumptionEnd() - getConsumptionStart(); 00523 }
Computes the largest number of contiguous bytes available to be consumed from this buffer, given the constraints that (a) the number of bytes must not be greater than cbLimit, and (b) partial tuples are not allowed.
cbLimit | upper bound on returned value |
Definition at line 83 of file CopyExecStream.cpp.
References TupleAccessor::getBufferByteCount(), getConsumptionAvailable(), getConsumptionStart(), and getConsumptionTupleAccessor().
Referenced by Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch().
00084 { 00085 uint cbAvailable = getConsumptionAvailable(); 00086 if (cbAvailable <= cbLimit) { 00087 return cbAvailable; 00088 } 00089 00090 TupleAccessor const &tupleAccessor = getConsumptionTupleAccessor(); 00091 PConstBuffer pSrc = getConsumptionStart(); 00092 00093 PConstBuffer pTuple = pSrc; 00094 PConstBuffer pTupleSafe = pTuple; 00095 PConstBuffer pEnd = pSrc + cbLimit; 00096 for (;;) { 00097 uint cbTuple = tupleAccessor.getBufferByteCount(pTuple); 00098 pTuple += cbTuple; 00099 if (pTuple > pEnd) { 00100 // this tuple would put us over the limit 00101 break; 00102 } 00103 // this tuple will fit 00104 pTupleSafe = pTuple; 00105 } 00106 return pTupleSafe - pSrc; 00107 }
uint ExecStreamBufAccessor::getConsumptionTuplesAvailable | ( | ) | [inline] |
Computes the number of tuples available to be consumed from this buffer.
Definition at line 525 of file ExecStreamBufAccessor.h.
References count(), getConsumptionEnd(), getConsumptionStart(), TupleAccessor::getCurrentByteCount(), getScratchTupleAccessor(), and TupleAccessor::setCurrentTupleBuf().
00526 { 00527 TupleAccessor& acc = getScratchTupleAccessor(); 00528 PConstBuffer p = getConsumptionStart(), 00529 end = getConsumptionEnd(); 00530 int count = 0; 00531 while (p < end) { 00532 acc.setCurrentTupleBuf(p); 00533 p += acc.getCurrentByteCount(); 00534 ++count; 00535 } 00536 return count; 00537 }
PConstBuffer ExecStreamBufAccessor::spanWholeTuples | ( | PConstBuffer | start, | |
uint | size | |||
) | [inline] |
Spans as many tuples as can be consumed from this buffer and will fit into a buffer of given size.
start | starting address in the source buffer | |
size | size of target buffer |
Definition at line 539 of file ExecStreamBufAccessor.h.
References TupleAccessor::getCurrentByteCount(), getScratchTupleAccessor(), and TupleAccessor::setCurrentTupleBuf().
00541 { 00542 TupleAccessor& acc = getScratchTupleAccessor(); 00543 assert(size > 0); 00544 PConstBuffer p = start; 00545 PConstBuffer pend = start + size; 00546 for (int ct = 0; ; ct++) { 00547 assert(p < pend); 00548 acc.setCurrentTupleBuf(p); 00549 PConstBuffer q = p; 00550 p += acc.getCurrentByteCount(); // forward 1 tuple 00551 if (p >= pend) { 00552 if (p == pend) { 00553 // fit the current tuple, but no more 00554 return p; 00555 } else { 00556 // here when p is too far, and the tuple [q, p] did not fit. 00557 return q; 00558 } 00559 } 00560 } 00561 assert(false); // not reached 00562 }
PBuffer ExecStreamBufAccessor::getProductionStart | ( | ) | const [inline] |
Accesses start of buffer into which data should be produced; called by producer.
Definition at line 565 of file ExecStreamBufAccessor.h.
References pProducer.
Referenced by ExternalSortOutput::fetch(), produceData(), and produceTuple().
00566 { 00567 return pProducer; 00568 }
PBuffer ExecStreamBufAccessor::getProductionEnd | ( | ) | const [inline] |
Accesses end of buffer into which data should be produced; called by producer.
Definition at line 570 of file ExecStreamBufAccessor.h.
References pBufEnd.
Referenced by produceData().
00571 { 00572 return pBufEnd; 00573 }
uint ExecStreamBufAccessor::getProductionAvailable | ( | ) | const [inline] |
Computes the number of contiguous bytes of buffer space available for producing data into this buffer.
Definition at line 575 of file ExecStreamBufAccessor.h.
References pBufEnd, and pProducer.
Referenced by ExternalSortOutput::fetch(), produceTuple(), and ExecStreamScheduler::traceStreamBuffers().
ExecStreamBufState ExecStreamBufAccessor::getState | ( | ) | const [inline] |
Retrieves the state of this accessor.
Definition at line 580 of file ExecStreamBufAccessor.h.
References state.
Referenced by JavaSinkExecStream::execute(), MockConsumerExecStream::execute(), DfsTreeExecStreamScheduler::findNextConsumer(), Java_net_sf_farrago_fennel_FennelStorage_tupleStreamFetch(), ParallelExecStreamScheduler::processCompletedTask(), produceTuple(), ParallelExecStreamScheduler::readStream(), and ExecStreamScheduler::traceStreamBuffers().
00581 { 00582 return state; 00583 }
bool ExecStreamBufAccessor::hasPendingEOS | ( | ) | const [inline] |
Retrieves the pending-end-of-stream flag.
Definition at line 585 of file ExecStreamBufAccessor.h.
References pendingEOS.
Referenced by ExecStreamScheduler::traceStreamBuffers().
00586 { 00587 return pendingEOS; 00588 }
ExecStreamBufProvision ExecStreamBufAccessor::getProvision | ( | ) | const [inline] |
Retrieves the buffer provision mode of this accessor.
Definition at line 590 of file ExecStreamBufAccessor.h.
References provision.
00591 { 00592 return provision; 00593 }
TupleDescriptor const & ExecStreamBufAccessor::getTupleDesc | ( | ) | const [inline] |
Retrieves the descriptor for tuples being accessed.
Definition at line 600 of file ExecStreamBufAccessor.h.
References tupleDesc.
Referenced by MockConsumerExecStream::execute(), and ExecStreamScheduler::traceStreamBufferContents().
00601 { 00602 return tupleDesc; 00603 }
TupleFormat ExecStreamBufAccessor::getTupleFormat | ( | ) | const [inline] |
Retrieves the format for tuples being accessed.
Definition at line 595 of file ExecStreamBufAccessor.h.
References tupleFormat.
00596 { 00597 return tupleFormat; 00598 }
void ExecStreamBufAccessor::validateTupleSize | ( | TupleData const & | tupleData | ) | [inline] |
Validates the size of a tuple, throwing a TupleOverflowExcn if it is bigger than the maximum buffer size.
tupleData | tuple to be produced |
Definition at line 633 of file ExecStreamBufAccessor.h.
References cbBuffer, TupleAccessor::getByteCount(), TupleAccessor::isBufferSufficient(), tupleDesc, and tupleProductionAccessor.
Referenced by produceTuple().
00635 { 00636 if (cbBuffer == 0) { 00637 return; // no buffer yet 00638 } 00639 if (!tupleProductionAccessor.isBufferSufficient(tupleData, cbBuffer)) { 00640 uint cbTuple = tupleProductionAccessor.getByteCount(tupleData); 00641 throw TupleOverflowExcn(tupleDesc, tupleData, cbTuple, cbBuffer); 00642 } 00643 }
bool ExecStreamBufAccessor::produceTuple | ( | TupleData const & | tupleData | ) | [inline] |
Attempts to marshal a tuple into the production buffer, placing the first byte at getProductionStart().
Definition at line 645 of file ExecStreamBufAccessor.h.
References EXECBUF_EOS, EXECBUF_NONEMPTY, TupleAccessor::getCurrentByteCount(), getProductionAvailable(), getProductionStart(), getState(), TupleAccessor::isBufferSufficient(), TupleAccessor::marshal(), pendingEOS, produceData(), requestConsumption(), tupleProductionAccessor, and validateTupleSize().
00646 { 00647 assert(getState() != EXECBUF_EOS); 00648 assert(!pendingEOS); 00649 00650 if (tupleProductionAccessor.isBufferSufficient( 00651 tupleData, getProductionAvailable())) 00652 { 00653 tupleProductionAccessor.marshal(tupleData, getProductionStart()); 00654 produceData( 00655 getProductionStart() 00656 + tupleProductionAccessor.getCurrentByteCount()); 00657 return true; 00658 } else { 00659 validateTupleSize(tupleData); 00660 if (getState() == EXECBUF_NONEMPTY) { 00661 requestConsumption(); 00662 } 00663 return false; 00664 } 00665 }
TupleAccessor & ExecStreamBufAccessor::accessConsumptionTuple | ( | ) | [inline] |
Accesses a tuple from getConsumptionStart() but does not unmarshal it or consume it.
Once this is called, it may not be called again until consumeTuple has been called.
Definition at line 667 of file ExecStreamBufAccessor.h.
References getConsumptionStart(), TupleAccessor::getCurrentTupleBuf(), isConsumptionPossible(), TupleAccessor::setCurrentTupleBuf(), and tupleConsumptionAccessor.
Referenced by unmarshalProjectedTuple(), and unmarshalTuple().
00668 { 00669 assert(isConsumptionPossible()); 00670 assert(!tupleConsumptionAccessor.getCurrentTupleBuf()); 00671 00672 tupleConsumptionAccessor.setCurrentTupleBuf(getConsumptionStart()); 00673 return tupleConsumptionAccessor; 00674 }
Unmarshals a tuple from getConsumptionStart() but does not consume it.
Once this is called, it may not be called again until consumeTuple has been called.
tupleData | receives unmarshalled data | |
iFirstDatum | see TupleAccessor::unmarshal |
Definition at line 676 of file ExecStreamBufAccessor.h.
References accessConsumptionTuple(), tupleConsumptionAccessor, and TupleAccessor::unmarshal().
Referenced by FtrsTableWriter::execute(), and MockConsumerExecStream::execute().
00678 { 00679 accessConsumptionTuple(); 00680 tupleConsumptionAccessor.unmarshal(tupleData, iFirstDatum); 00681 }
void ExecStreamBufAccessor::consumeTuple | ( | ) | [inline] |
Consumes last tuple accessed via accessConsumptionTuple() or unmarshalTuple().
Definition at line 683 of file ExecStreamBufAccessor.h.
References consumeData(), getConsumptionStart(), TupleAccessor::getCurrentByteCount(), TupleAccessor::getCurrentTupleBuf(), TupleAccessor::resetCurrentTupleBuf(), and tupleConsumptionAccessor.
Referenced by FtrsTableWriter::execute(), and MockConsumerExecStream::execute().
00684 { 00685 assert(tupleConsumptionAccessor.getCurrentTupleBuf()); 00686 00687 consumeData( 00688 getConsumptionStart() + tupleConsumptionAccessor.getCurrentByteCount()); 00689 tupleConsumptionAccessor.resetCurrentTupleBuf(); 00690 }
bool ExecStreamBufAccessor::isTupleConsumptionPending | ( | ) | const [inline] |
Definition at line 692 of file ExecStreamBufAccessor.h.
References TupleAccessor::getCurrentTupleBuf(), and tupleConsumptionAccessor.
00693 { 00694 if (tupleConsumptionAccessor.getCurrentTupleBuf()) { 00695 return true; 00696 } else { 00697 return false; 00698 } 00699 }
TupleAccessor & ExecStreamBufAccessor::getConsumptionTupleAccessor | ( | ) | [inline] |
Definition at line 701 of file ExecStreamBufAccessor.h.
References tupleConsumptionAccessor.
Referenced by FtrsTableWriter::execute(), and getConsumptionAvailableBounded().
00702 { 00703 return tupleConsumptionAccessor; 00704 }
TupleAccessor & ExecStreamBufAccessor::getScratchTupleAccessor | ( | ) | [inline] |
Definition at line 706 of file ExecStreamBufAccessor.h.
References tupleProductionAccessor.
Referenced by getConsumptionTuplesAvailable(), spanWholeTuples(), and ExecStreamScheduler::traceStreamBufferContents().
00707 { 00708 // this can be used for scratch purposes since we don't need its state 00709 // across calls to produceTuple 00710 return tupleProductionAccessor; 00711 }
void ExecStreamBufAccessor::bindProjection | ( | TupleProjection const & | inputProj | ) | [inline] |
Binds projection accessor to the input tuple accessor.
inputProj | 0-based vector of projected columns |
Definition at line 725 of file ExecStreamBufAccessor.h.
References TupleProjectionAccessor::bind(), tupleConsumptionAccessor, and tupleProjectionAccessor.
00727 { 00728 tupleProjectionAccessor.bind(tupleConsumptionAccessor, inputProj); 00729 }
void ExecStreamBufAccessor::unmarshalProjectedTuple | ( | TupleData & | projTupleData | ) | [inline] |
Unmarshals projected tuple from input stream.
projTupleData | projected tuple |
Definition at line 731 of file ExecStreamBufAccessor.h.
References accessConsumptionTuple(), tupleProjectionAccessor, and TupleProjectionAccessor::unmarshal().
00733 { 00734 accessConsumptionTuple(); 00735 tupleProjectionAccessor.unmarshal(projTupleData); 00736 }
PBuffer ExecStreamBufAccessor::pBufStart [private] |
Definition at line 48 of file ExecStreamBufAccessor.h.
Referenced by clear(), provideBufferForConsumption(), provideBufferForProduction(), and requestProduction().
PBuffer ExecStreamBufAccessor::pBufEnd [private] |
Definition at line 50 of file ExecStreamBufAccessor.h.
Referenced by clear(), getProductionAvailable(), getProductionEnd(), provideBufferForConsumption(), and provideBufferForProduction().
PBuffer ExecStreamBufAccessor::pProducer [private] |
Definition at line 52 of file ExecStreamBufAccessor.h.
Referenced by clear(), getConsumptionEnd(), getProductionAvailable(), getProductionStart(), produceData(), provideBufferForConsumption(), provideBufferForProduction(), requestProduction(), and setEOS().
PBuffer ExecStreamBufAccessor::pConsumer [private] |
Definition at line 54 of file ExecStreamBufAccessor.h.
Referenced by clear(), consumeData(), getConsumptionStart(), provideBufferForConsumption(), provideBufferForProduction(), requestProduction(), and setEOS().
Definition at line 56 of file ExecStreamBufAccessor.h.
Referenced by ExecStreamBufAccessor(), getProvision(), provideBufferForConsumption(), provideBufferForProduction(), and setProvision().
Definition at line 58 of file ExecStreamBufAccessor.h.
Referenced by clear(), consumeData(), demandData(), ExecStreamBufAccessor(), getState(), isConsumptionPossible(), isProductionPossible(), produceData(), provideBufferForConsumption(), provideBufferForProduction(), requestConsumption(), requestProduction(), and setEOS().
bool ExecStreamBufAccessor::pendingEOS [private] |
Definition at line 60 of file ExecStreamBufAccessor.h.
Referenced by clear(), consumeData(), hasPendingEOS(), isProductionPossible(), markEOS(), and produceTuple().
Definition at line 62 of file ExecStreamBufAccessor.h.
Referenced by getTupleDesc(), setTupleShape(), and validateTupleSize().
Definition at line 64 of file ExecStreamBufAccessor.h.
Referenced by ExecStreamBufAccessor(), getTupleFormat(), and setTupleShape().
Definition at line 66 of file ExecStreamBufAccessor.h.
Referenced by clear(), getScratchTupleAccessor(), produceTuple(), setTupleShape(), and validateTupleSize().
Definition at line 68 of file ExecStreamBufAccessor.h.
Referenced by accessConsumptionTuple(), bindProjection(), clear(), consumeTuple(), getConsumptionTupleAccessor(), isTupleConsumptionPending(), setTupleShape(), and unmarshalTuple().
Definition at line 70 of file ExecStreamBufAccessor.h.
Referenced by bindProjection(), and unmarshalProjectedTuple().
uint ExecStreamBufAccessor::cbBuffer [private] |
Definition at line 72 of file ExecStreamBufAccessor.h.
Referenced by clear(), ExecStreamBufAccessor(), provideBufferForProduction(), and validateTupleSize().