|
Squid Web Cache v8/master
|
#include <BodyPipe.h>
Public Types | |
| typedef RefCount< BodyPipe > | Pointer |
| typedef BodyProducer | Producer |
| typedef BodyConsumer | Consumer |
| typedef BodyPipeCheckout | Checkout |
Public Member Functions | |
| BodyPipe (Producer *aProducer) | |
| ~BodyPipe () override | |
| void | setBodySize (uint64_t aSize) |
| bool | bodySizeKnown () const |
| uint64_t | bodySize () const |
| uint64_t | consumedSize () const |
| uint64_t | producedSize () const |
| bool | productionEnded () const |
| void | clearProducer (bool atEof) |
| size_t | putMoreData (const char *buf, size_t size) |
| bool | mayNeedMoreData () const |
| bool | needsMoreData () const |
| uint64_t | unproducedSize () const |
| bool | stillProducing (const Producer::Pointer &producer) const |
| void | expectProductionEndAfter (uint64_t extraSize) |
| sets or checks body size | |
| bool | setConsumerIfNotLate (const Consumer::Pointer &aConsumer) |
| void | clearConsumer () |
| void | expectNoConsumption () |
| there will be no more setConsumer() calls | |
| size_t | getMoreData (MemBuf &buf) |
| void | consume (size_t size) |
| bool | expectMoreAfter (uint64_t offset) const |
| bool | exhausted () const |
| bool | stillConsuming (const Consumer::Pointer &consumer) const |
| void | enableAutoConsumption () |
| start or continue consuming when producing without consumer | |
| const MemBuf & | buf () const |
| const char * | status () const |
Static Public Attributes | |
| static constexpr size_t | MaxCapacity = 64*1024 |
Protected Member Functions | |
| MemBuf & | checkOut () |
| void | checkIn (Checkout &checkout) |
| void | undoCheckOut (Checkout &checkout) |
| void | scheduleBodyDataNotification () |
| void | scheduleBodyEndNotification () |
| void | postConsume (size_t size) |
| void | postAppend (size_t size) |
| void | startAutoConsumptionIfNeeded () |
Private Member Functions | |
| MEMPROXY_CLASS (BodyPipe) | |
Private Attributes | |
| int64_t | theBodySize |
| Producer::Pointer | theProducer |
| Consumer::Pointer | theConsumer |
| uint64_t | thePutSize |
| uint64_t | theGetSize |
| MemBuf | theBuf |
| bool | mustAutoConsume |
| keep theBuf empty when producing without consumer | |
| bool | abortedConsumption |
| called BodyProducer::noteBodyConsumerAborted | |
| bool | isCheckedOut |
Friends | |
| class | BodyPipeCheckout |
Connects those who produces message body content with those who consume it. For example, connects ConnStateData with FtpStateData OR ICAPModXact with HttpStateData.
Definition at line 90 of file BodyPipe.h.
| typedef BodyPipeCheckout BodyPipe::Checkout |
Definition at line 98 of file BodyPipe.h.
| typedef BodyConsumer BodyPipe::Consumer |
Definition at line 97 of file BodyPipe.h.
| typedef RefCount<BodyPipe> BodyPipe::Pointer |
Definition at line 95 of file BodyPipe.h.
| typedef BodyProducer BodyPipe::Producer |
Definition at line 96 of file BodyPipe.h.
| BodyPipe::BodyPipe | ( | Producer * | aProducer | ) |
Definition at line 128 of file BodyPipe.cc.
References debugs, MemBuf::init(), MaxCapacity, status(), and theBuf.
|
override |
Definition at line 139 of file BodyPipe.cc.
References assert, MemBuf::clean(), debugs, status(), theBuf, theConsumer, and theProducer.
| uint64_t BodyPipe::bodySize | ( | ) | const |
Definition at line 161 of file BodyPipe.cc.
References assert, bodySizeKnown(), and theBodySize.
Referenced by clearProducer(), expectProductionEndAfter(), ConnStateData::finishDechunkingRequest(), Adaptation::Icap::ModXact::prepEchoing(), scheduleBodyEndNotification(), and unproducedSize().
|
inline |
Definition at line 109 of file BodyPipe.h.
References theBodySize.
Referenced by bodySize(), clearProducer(), expectProductionEndAfter(), ConnStateData::finishDechunkingRequest(), mayNeedMoreData(), ConnStateData::mayNeedToReadMoreBody(), needsMoreData(), Adaptation::Icap::ModXact::prepEchoing(), putMoreData(), scheduleBodyEndNotification(), and setBodySize().
|
inline |
Definition at line 137 of file BodyPipe.h.
References theBuf.
Referenced by Client::calcBufferSpaceToReserve(), Adaptation::Icap::ModXact::estimateVirginBody(), ConnStateData::handleChunkedRequestBody(), Client::handleMoreAdaptedBodyAvailable(), BodySink::noteMoreBodyDataAvailable(), ClientHttpRequest::noteMoreBodyDataAvailable(), HttpStateData::readReply(), Adaptation::Ecap::XactionRep::vbContent(), Adaptation::Ecap::XactionRep::vbContentShift(), and Adaptation::Icap::ModXact::virginConsume().
|
protected |
Definition at line 352 of file BodyPipe.cc.
References assert, BodyPipeCheckout::checkedOutSize, MemBuf::contentSize(), isCheckedOut, postAppend(), postConsume(), and theBuf.
Referenced by BodyPipeCheckout::~BodyPipeCheckout(), and BodyPipeCheckout::checkIn().
|
protected |
Definition at line 344 of file BodyPipe.cc.
References assert, isCheckedOut, and theBuf.
| void BodyPipe::clearConsumer | ( | ) |
Definition at line 254 of file BodyPipe.cc.
References CbcPointer< Cbc >::clear(), consumedSize(), debugs, expectNoConsumption(), CbcPointer< Cbc >::set(), status(), and theConsumer.
Referenced by Adaptation::Message::ShortCircuit().
| void BodyPipe::clearProducer | ( | bool | atEof | ) |
Definition at line 194 of file BodyPipe.cc.
References assert, bodySize(), bodySizeKnown(), CbcPointer< Cbc >::clear(), debugs, scheduleBodyEndNotification(), CbcPointer< Cbc >::set(), status(), theBodySize, theProducer, and thePutSize.
Referenced by postAppend().
| void BodyPipe::consume | ( | size_t | size | ) |
Definition at line 309 of file BodyPipe.cc.
References MemBuf::consume(), postConsume(), size, and theBuf.
Referenced by BodySink::noteMoreBodyDataAvailable(), Adaptation::Ecap::XactionRep::vbContentShift(), and Adaptation::Icap::ModXact::virginConsume().
|
inline |
Definition at line 111 of file BodyPipe.h.
References theGetSize.
Referenced by HttpRequest::bodyNibbled(), clearConsumer(), ClientHttpRequest::handleAdaptationFailure(), Client::handleMoreAdaptedBodyAvailable(), Adaptation::Ecap::XactionRep::preserveVb(), and Adaptation::Message::ShortCircuit().
| void BodyPipe::enableAutoConsumption | ( | ) |
Definition at line 316 of file BodyPipe.cc.
References debugs, mustAutoConsume, startAutoConsumptionIfNeeded(), and status().
Referenced by ConnStateData::noteBodyConsumerAborted(), and Adaptation::Ecap::XactionRep::sinkVb().
| bool BodyPipe::exhausted | ( | ) | const |
Definition at line 174 of file BodyPipe.cc.
References expectMoreAfter(), and theGetSize.
Referenced by Client::checkAdaptationWithBodyCompletion(), expectNoConsumption(), Client::handleAdaptedBodyProducerAborted(), ClientHttpRequest::noteBodyProductionEnded(), ClientHttpRequest::noteMoreBodyDataAvailable(), and Client::sentRequestBody().
| bool BodyPipe::expectMoreAfter | ( | uint64_t | offset | ) | const |
Definition at line 167 of file BodyPipe.cc.
References assert, mayNeedMoreData(), productionEnded(), theGetSize, and thePutSize.
Referenced by exhausted().
| void BodyPipe::expectNoConsumption | ( | ) |
Definition at line 267 of file BodyPipe.cc.
References abortedConsumption, asyncCall(), debugs, exhausted(), BodyProducer::noteBodyConsumerAborted(), ScheduleCallHere, startAutoConsumptionIfNeeded(), status(), theConsumer, and theProducer.
Referenced by clearConsumer(), FwdState::doneWithRetries(), ConnStateData::expectNoForwarding(), and Client::handleAdaptedHeader().
| void BodyPipe::expectProductionEndAfter | ( | uint64_t | extraSize | ) |
Definition at line 184 of file BodyPipe.cc.
References bodySize(), bodySizeKnown(), Must, size, theBodySize, and thePutSize.
Definition at line 294 of file BodyPipe.cc.
References MemBuf::append(), MemBuf::consume(), MemBuf::content(), MemBuf::contentSize(), MemBuf::hasContent(), MemBuf::init(), MemBuf::isNull(), min(), postConsume(), MemBuf::potentialSpaceSize(), size, and theBuf.
Referenced by Client::getMoreRequestBody(), and HttpStateData::getMoreRequestBody().
|
inline |
Definition at line 118 of file BodyPipe.h.
References bodySizeKnown(), and needsMoreData().
Referenced by expectMoreAfter(), ConnStateData::handleChunkedRequestBody(), ConnStateData::handleRequestBodyData(), postAppend(), postConsume(), and Adaptation::Ecap::XactionRep::vbMakeMore().
|
private |
|
inline |
Definition at line 119 of file BodyPipe.h.
References bodySizeKnown(), and unproducedSize().
Referenced by mayNeedMoreData().
|
protected |
Definition at line 395 of file BodyPipe.cc.
References assert, clearProducer(), debugs, isCheckedOut, mayNeedMoreData(), scheduleBodyDataNotification(), size, startAutoConsumptionIfNeeded(), status(), and thePutSize.
Referenced by checkIn(), and putMoreData().
|
protected |
Definition at line 380 of file BodyPipe.cc.
References assert, asyncCall(), debugs, isCheckedOut, mayNeedMoreData(), BodyProducer::noteMoreBodySpaceAvailable(), ScheduleCallHere, size, status(), theGetSize, and theProducer.
Referenced by checkIn(), consume(), and getMoreData().
|
inline |
Definition at line 112 of file BodyPipe.h.
References thePutSize.
Referenced by Adaptation::Icap::ModXact::finalizeLogInfo(), ConnStateData::handleChunkedRequestBody(), and ClientHttpRequest::logRequest().
|
inline |
Definition at line 113 of file BodyPipe.h.
References theProducer.
Referenced by clientProcessRequest(), expectMoreAfter(), and Adaptation::Ecap::XactionRep::vbMakeMore().
Definition at line 213 of file BodyPipe.cc.
References MemBuf::append(), bodySizeKnown(), min(), postAppend(), MemBuf::potentialSpaceSize(), size, theBuf, and unproducedSize().
Referenced by Client::adaptVirginReplyBody(), and ConnStateData::handleRequestBodyData().
|
protected |
Definition at line 414 of file BodyPipe.cc.
References asyncCall(), BodyConsumer::noteMoreBodyDataAvailable(), ScheduleCallHere, theConsumer, and CbcPointer< Cbc >::valid().
Referenced by postAppend(), setConsumerIfNotLate(), and startAutoConsumptionIfNeeded().
|
protected |
Definition at line 426 of file BodyPipe.cc.
References asyncCall(), bodySize(), bodySizeKnown(), BodyConsumer::noteBodyProducerAborted(), BodyConsumer::noteBodyProductionEnded(), ScheduleCallHere, theConsumer, thePutSize, and CbcPointer< Cbc >::valid().
Referenced by clearProducer(), and setConsumerIfNotLate().
| void BodyPipe::setBodySize | ( | uint64_t | aSize | ) |
Definition at line 147 of file BodyPipe.cc.
References assert, bodySizeKnown(), debugs, status(), theBodySize, theConsumer, and thePutSize.
Referenced by ConnStateData::expectRequestBody(), and Client::startAdaptation().
| bool BodyPipe::setConsumerIfNotLate | ( | const Consumer::Pointer & | aConsumer | ) |
Definition at line 228 of file BodyPipe.cc.
References abortedConsumption, assert, debugs, MemBuf::hasContent(), Must, mustAutoConsume, scheduleBodyDataNotification(), scheduleBodyEndNotification(), CbcPointer< Cbc >::set(), status(), theBuf, theConsumer, theGetSize, and theProducer.
Referenced by ClientHttpRequest::handleAdaptedHeader(), Client::handleAdaptedHeader(), Client::startRequestBodyFlow(), and Adaptation::Ecap::XactionRep::vbMake().
|
protected |
Check the current need and, if needed, start auto consumption. In auto consumption mode, the consumer is gone, but the producer continues to produce data. We use a BodySink BodyConsumer to discard that data.
Definition at line 327 of file BodyPipe.cc.
References debugs, MemBuf::hasContent(), mustAutoConsume, scheduleBodyDataNotification(), AsyncJob::Start(), status(), theBuf, theConsumer, theProducer, and CbcPointer< Cbc >::valid().
Referenced by enableAutoConsumption(), expectNoConsumption(), and postAppend().
| const char * BodyPipe::status | ( | ) | const |
Definition at line 446 of file BodyPipe.cc.
References abortedConsumption, MemBuf::append(), Packable::appendf(), MemBuf::content(), MemBuf::contentSize(), CbcPointer< Cbc >::get(), isCheckedOut, mustAutoConsume, PRId64, PRIu64, MemBuf::reset(), CbcPointer< Cbc >::set(), MemBuf::spaceSize(), MemBuf::terminate(), theBodySize, theBuf, theConsumer, theGetSize, theProducer, and thePutSize.
Referenced by BodyPipe(), ~BodyPipe(), BodyProducerDialer::canDial(), BodyConsumerDialer::canDial(), Client::checkAdaptationWithBodyCompletion(), clearConsumer(), clearProducer(), enableAutoConsumption(), expectNoConsumption(), ConnStateData::expectNoForwarding(), ConnStateData::finishDechunkingRequest(), ConnStateData::handleChunkedRequestBody(), postAppend(), postConsume(), setBodySize(), setConsumerIfNotLate(), startAutoConsumptionIfNeeded(), ConnStateData::startDechunkingRequest(), Client::startRequestBodyFlow(), and Adaptation::Icap::ModXact::virginConsume().
|
inline |
Definition at line 132 of file BodyPipe.h.
References theConsumer.
Referenced by BodyConsumerDialer::canDial(), Adaptation::Ecap::XactionRep::forgetVb(), Adaptation::Ecap::XactionRep::status(), Adaptation::Ecap::XactionRep::swanSong(), and Adaptation::Ecap::XactionRep::vbMakeMore().
|
inline |
Definition at line 121 of file BodyPipe.h.
References theProducer.
Referenced by BodyProducerDialer::canDial(), Adaptation::Ecap::XactionRep::status(), and Adaptation::Ecap::XactionRep::swanSong().
|
protected |
Definition at line 364 of file BodyPipe.cc.
References assert, BodyPipeCheckout::checkedOutSize, MemBuf::contentSize(), isCheckedOut, Must, and theBuf.
| uint64_t BodyPipe::unproducedSize | ( | ) | const |
Definition at line 179 of file BodyPipe.cc.
References bodySize(), and thePutSize.
Referenced by ConnStateData::mayNeedToReadMoreBody(), needsMoreData(), and putMoreData().
|
friend |
Definition at line 102 of file BodyPipe.h.
|
private |
Definition at line 167 of file BodyPipe.h.
Referenced by expectNoConsumption(), setConsumerIfNotLate(), and status().
|
private |
Definition at line 168 of file BodyPipe.h.
Referenced by checkIn(), checkOut(), postAppend(), postConsume(), status(), and undoCheckOut().
|
staticconstexpr |
Definition at line 100 of file BodyPipe.h.
Referenced by BodyPipe().
|
private |
Definition at line 166 of file BodyPipe.h.
Referenced by enableAutoConsumption(), setConsumerIfNotLate(), startAutoConsumptionIfNeeded(), and status().
|
private |
Definition at line 157 of file BodyPipe.h.
Referenced by bodySize(), bodySizeKnown(), clearProducer(), expectProductionEndAfter(), setBodySize(), and status().
|
private |
Definition at line 164 of file BodyPipe.h.
Referenced by BodyPipe(), ~BodyPipe(), buf(), checkIn(), checkOut(), consume(), getMoreData(), putMoreData(), setConsumerIfNotLate(), startAutoConsumptionIfNeeded(), status(), and undoCheckOut().
|
private |
Definition at line 159 of file BodyPipe.h.
Referenced by ~BodyPipe(), clearConsumer(), expectNoConsumption(), scheduleBodyDataNotification(), scheduleBodyEndNotification(), setBodySize(), setConsumerIfNotLate(), startAutoConsumptionIfNeeded(), status(), and stillConsuming().
|
private |
Definition at line 162 of file BodyPipe.h.
Referenced by consumedSize(), exhausted(), expectMoreAfter(), postConsume(), setConsumerIfNotLate(), and status().
|
private |
Definition at line 158 of file BodyPipe.h.
Referenced by ~BodyPipe(), clearProducer(), expectNoConsumption(), postConsume(), productionEnded(), setConsumerIfNotLate(), startAutoConsumptionIfNeeded(), status(), and stillProducing().
|
private |
Definition at line 161 of file BodyPipe.h.
Referenced by clearProducer(), expectMoreAfter(), expectProductionEndAfter(), postAppend(), producedSize(), scheduleBodyEndNotification(), setBodySize(), status(), and unproducedSize().