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

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

Friends

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
Enumerator
MaxCapacity 

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, HERE(), MemBuf::init(), MaxCapacity, status(), and theBuf.

◆ ~BodyPipe()

BodyPipe::~BodyPipe ( )

Definition at line 139 of file BodyPipe.cc.

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

Member Function Documentation

◆ bodySize()

◆ bodySizeKnown()

◆ buf()

◆ checkIn()

void BodyPipe::checkIn ( Checkout checkout)
protected

◆ checkOut()

MemBuf & BodyPipe::checkOut ( )
protected

Definition at line 343 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

◆ expectNoConsumption()

◆ expectProductionEndAfter()

void BodyPipe::expectProductionEndAfter ( uint64_t  extraSize)

◆ getMoreData()

◆ mayNeedMoreData()

bool BodyPipe::mayNeedMoreData ( ) const
inline

◆ MEMPROXY_CLASS()

BodyPipe::MEMPROXY_CLASS ( BodyPipe  )
private

◆ needsMoreData()

bool BodyPipe::needsMoreData ( ) const
inline

Definition at line 119 of file BodyPipe.h.

Referenced by Adaptation::Icap::ModXact::stopSending().

◆ postAppend()

void BodyPipe::postAppend ( size_t  size)
protected

◆ postConsume()

void BodyPipe::postConsume ( size_t  size)
protected

◆ producedSize()

uint64_t BodyPipe::producedSize ( ) const
inline

Definition at line 112 of file BodyPipe.h.

Referenced by Adaptation::Icap::ModXact::finalizeLogInfo().

◆ productionEnded()

◆ putMoreData()

◆ scheduleBodyDataNotification()

void BodyPipe::scheduleBodyDataNotification ( )
protected

◆ scheduleBodyEndNotification()

◆ setBodySize()

◆ setConsumerIfNotLate()

◆ startAutoConsumptionIfNeeded()

void BodyPipe::startAutoConsumptionIfNeeded ( )
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(), HERE(), mustAutoConsume, scheduleBodyDataNotification(), 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
inline

◆ undoCheckOut()

void BodyPipe::undoCheckOut ( Checkout checkout)
protected

◆ unproducedSize()

uint64_t BodyPipe::unproducedSize ( ) const

Definition at line 179 of file BodyPipe.cc.

References bodySize(), and thePutSize.

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

Friends And Related Function Documentation

◆ BodyPipeCheckout

friend class BodyPipeCheckout
friend

Definition at line 102 of file BodyPipe.h.

Member Data Documentation

◆ abortedConsumption

bool BodyPipe::abortedConsumption
private

Definition at line 167 of file BodyPipe.h.

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

◆ isCheckedOut

bool BodyPipe::isCheckedOut
private

Definition at line 168 of file BodyPipe.h.

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

◆ mustAutoConsume

bool BodyPipe::mustAutoConsume
private

◆ theBodySize

int64_t BodyPipe::theBodySize
private

Definition at line 157 of file BodyPipe.h.

Referenced by bodySize(), clearProducer(), expectProductionEndAfter(), setBodySize(), and status().

◆ theBuf

◆ theConsumer

◆ theGetSize

uint64_t BodyPipe::theGetSize
private

Definition at line 162 of file BodyPipe.h.

Referenced by exhausted(), expectMoreAfter(), postConsume(), setConsumerIfNotLate(), and status().

◆ theProducer

◆ thePutSize

uint64_t BodyPipe::thePutSize
private

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors