#include <BodyPipe.h>

Inheritance diagram for BodyPipe:
Collaboration diagram for BodyPipe:

Public Types

enum  { MaxCapacity = 64*1024 }
typedef RefCount< BodyPipePointer
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 More...
bool setConsumerIfNotLate (const Consumer::Pointer &aConsumer)
void clearConsumer ()
void expectNoConsumption ()
 there will be no more setConsumer() calls More...
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 More...
const MemBufbuf () const
const char * status () const

Protected Member Functions

MemBufcheckOut ()
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


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 More...
bool abortedConsumption
 called BodyProducer::noteBodyConsumerAborted More...
bool isCheckedOut


class BodyPipeCheckout

Detailed Description

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.

Member Typedef Documentation

◆ Checkout

Definition at line 98 of file BodyPipe.h.

◆ Consumer

Definition at line 97 of file BodyPipe.h.

◆ Pointer

Definition at line 95 of file BodyPipe.h.

◆ Producer

Definition at line 96 of file BodyPipe.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 100 of file BodyPipe.h.

Constructor & Destructor Documentation

◆ BodyPipe()

BodyPipe::BodyPipe ( Producer aProducer)

Definition at line 128 of file BodyPipe.cc.

References debugs, MemBuf::init(), MaxCapacity, status(), and theBuf.

◆ ~BodyPipe()

BodyPipe::~BodyPipe ( )

Definition at line 139 of file BodyPipe.cc.

References assert, MemBuf::clean(), debugs, status(), theBuf, theConsumer, and theProducer.

Member Function Documentation

◆ bodySize()

◆ bodySizeKnown()

◆ buf()

◆ checkIn()

void BodyPipe::checkIn ( Checkout checkout)

◆ checkOut()

MemBuf & BodyPipe::checkOut ( )

Definition at line 344 of file BodyPipe.cc.

References assert, isCheckedOut, and theBuf.

◆ clearConsumer()

◆ clearProducer()

◆ consume()

◆ consumedSize()

◆ enableAutoConsumption()

void BodyPipe::enableAutoConsumption ( )

◆ exhausted()

◆ expectMoreAfter()

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().

◆ expectNoConsumption()

◆ expectProductionEndAfter()

void BodyPipe::expectProductionEndAfter ( uint64_t  extraSize)

Definition at line 184 of file BodyPipe.cc.

References bodySize(), bodySizeKnown(), Must, size, theBodySize, and thePutSize.

◆ getMoreData()

◆ mayNeedMoreData()


BodyPipe::MEMPROXY_CLASS ( BodyPipe  )

◆ needsMoreData()

bool BodyPipe::needsMoreData ( ) const

Definition at line 119 of file BodyPipe.h.

References bodySizeKnown(), and unproducedSize().

Referenced by mayNeedMoreData().

◆ postAppend()

void BodyPipe::postAppend ( size_t  size)

◆ postConsume()

void BodyPipe::postConsume ( size_t  size)

◆ producedSize()

uint64_t BodyPipe::producedSize ( ) const

◆ productionEnded()

bool BodyPipe::productionEnded ( ) const

◆ putMoreData()

size_t BodyPipe::putMoreData ( const char *  buf,
size_t  size 

◆ scheduleBodyDataNotification()

void BodyPipe::scheduleBodyDataNotification ( )

◆ scheduleBodyEndNotification()

◆ setBodySize()

void BodyPipe::setBodySize ( uint64_t  aSize)

◆ setConsumerIfNotLate()

◆ startAutoConsumptionIfNeeded()

void BodyPipe::startAutoConsumptionIfNeeded ( )

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().

◆ status()

◆ stillConsuming()

◆ stillProducing()

bool BodyPipe::stillProducing ( const Producer::Pointer producer) const

◆ undoCheckOut()

void BodyPipe::undoCheckOut ( Checkout checkout)

◆ unproducedSize()

uint64_t BodyPipe::unproducedSize ( ) const

Definition at line 179 of file BodyPipe.cc.

References bodySize(), and thePutSize.

Referenced by ConnStateData::mayNeedToReadMoreBody(), needsMoreData(), and putMoreData().

Friends And Related Function Documentation

◆ BodyPipeCheckout

friend class BodyPipeCheckout

Definition at line 102 of file BodyPipe.h.

Member Data Documentation

◆ abortedConsumption

bool BodyPipe::abortedConsumption

Definition at line 167 of file BodyPipe.h.

Referenced by expectNoConsumption(), setConsumerIfNotLate(), and status().

◆ isCheckedOut

bool BodyPipe::isCheckedOut

Definition at line 168 of file BodyPipe.h.

Referenced by checkIn(), checkOut(), postAppend(), postConsume(), status(), and undoCheckOut().

◆ mustAutoConsume

bool BodyPipe::mustAutoConsume

◆ theBodySize

int64_t BodyPipe::theBodySize

◆ theBuf

◆ theConsumer

◆ theGetSize

uint64_t BodyPipe::theGetSize

◆ theProducer

◆ thePutSize

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






Web Site Translations