Inheritance diagram for ShmWriter:
Collaboration diagram for ShmWriter:

Public Member Functions

 ShmWriter (MemStore &aStore, StoreEntry *anEntry, const sfileno aFileNo, Ipc::StoreMapSliceId aFirstSlice=-1)
 
virtual void append (const char *aBuf, int aSize) override
 Appends a c-string to existing packed data. More...
 
virtual void vappendf (const char *fmt, va_list ap) override
 
void appendf (const char *fmt,...) PRINTF_FORMAT_ARG2
 Append operation with printf-style arguments. More...
 
virtual void buffer ()
 
virtual void flush ()
 

Public Attributes

StoreEntryentry
 the entry being updated More...
 
Ipc::StoreMapSliceId firstSlice
 
Ipc::StoreMapSliceId lastSlice
 the slot keeping the last byte of the appended content (at least) More...
 
uint64_t totalWritten
 cumulative number of bytes appended so far More...
 

Protected Member Functions

void copyToShm ()
 copies the entire buffer to shared memory More...
 
void copyToShmSlice (Ipc::StoreMap::Slice &slice)
 copies at most one slice worth of buffer to shared memory More...
 

Private Attributes

MemStorestore
 
const sfileno fileNo
 
const char * buf
 content being appended now More...
 
int bufSize
 buf size More...
 
int bufWritten
 buf bytes appended so far More...
 

Detailed Description

Packs to shared memory, allocating new slots/pages as needed. Requires an Ipc::StoreMapAnchor locked for writing.

Definition at line 40 of file MemStore.cc.

Constructor & Destructor Documentation

ShmWriter::ShmWriter ( MemStore aStore,
StoreEntry anEntry,
const sfileno  aFileNo,
Ipc::StoreMapSliceId  aFirstSlice = -1 
)

Definition at line 77 of file MemStore.cc.

References entry, and Must.

Member Function Documentation

void ShmWriter::append ( const char *  buf,
int  size 
)
overridevirtual

Implements Packable.

Definition at line 92 of file MemStore.cc.

References buf, bufSize, bufWritten, copyToShm(), and Must.

Referenced by MemStore::updateHeadersOrThrow(), and vappendf().

void Packable::appendf ( const char *  fmt,
  ... 
)
inlineinherited

Definition at line 61 of file Packable.h.

References Packable::vappendf().

Referenced by Ftp::Server::acceptDataConnection(), aclParseAccessLine(), aclParseAclList(), Format::Format::assemble(), HttpStateData::buildRequestPrefix(), clientPackRangeHdr(), clientPackTermBound(), ErrorState::Convert(), ErrorState::ConvertText(), ErrorState::DenyInfoLocation(), ErrorState::Dump(), dump_cachemgrpasswd(), Security::ServerOptions::dumpCfg(), Security::PeerOptions::dumpCfg(), store_client::dumpStats(), Adaptation::Icap::ModXact::encapsulateHead(), errorInitialize(), Adaptation::Icap::Xaction::fillDoneStatus(), Adaptation::Icap::ModXact::fillDoneStatus(), Adaptation::Icap::Xaction::fillPendingStatus(), Adaptation::Icap::ModXact::fillPendingStatus(), HttpStateData::getMoreRequestBody(), gopherSendRequest(), Ftp::Server::handleEpsvReply(), Ftp::Server::handlePasvReply(), helperDispatch(), Ftp::Gateway::htmlifyListEntry(), httpHdrContRangePackInto(), httpHdrRangeRespSpecPackInto(), internalRemoteUri(), Adaptation::Icap::ModXact::makeAllowHeader(), Adaptation::Icap::OptXact::makeRequest(), Adaptation::Icap::ModXact::makeRequestHeaders(), Adaptation::Icap::ModXact::makeUsernameHeader(), memBufReport(), munge_menu_line(), munge_other_line(), Adaptation::Icap::ModXact::openChunk(), HttpRequest::pack(), Http::Stream::packChunk(), HttpRequest::packFirstLineInto(), HttpHdrRangeSpec::packInto(), Http::StatusLine::packInto(), HttpHdrScTarget::packInto(), HttpHdrCc::packInto(), helper::packStatsInto(), Acl::AllOf::parse(), Ftp::PrintReply(), Ftp::Client::sendEprt(), Ftp::Client::sendPassive(), ExternalACLLookup::Start(), Ident::Start(), MemObject::stat(), statStoreEntry(), Ipc::Inquirer::status(), Comm::TcpAcceptor::status(), AsyncJob::status(), Adaptation::Ecap::XactionRep::status(), Security::PeerConnector::status(), Adaptation::Icap::Xaction::status(), BodyPipe::status(), Adaptation::Icap::ServiceRep::status(), tunnelRelayConnectRequest(), urnHandleReply(), wordlistCat(), Ftp::Server::writeCustomReply(), Ftp::Server::writeEarlyReply(), and Ftp::Server::writeErrorReply().

virtual void Packable::buffer ( )
inlinevirtualinherited

start buffering appends (if relevant)

Indicates that a number of small appends are about to follow so would be detrimental to trigger expensive activity on each.

Reimplemented in StoreEntry, and CapturingStoreEntry.

Definition at line 88 of file Packable.h.

Referenced by PackableStreamBuf::PackableStreamBuf().

void ShmWriter::copyToShm ( )
protected
void ShmWriter::copyToShmSlice ( Ipc::StoreMap::Slice slice)
protected
virtual void Packable::flush ( )
inlinevirtualinherited

perform a buffer flush (if relevant)

Used by code such as PackableStream, that assumes the Packable leads to some form of output buffer.

Reimplemented in StoreEntry, and CapturingStoreEntry.

Definition at line 95 of file Packable.h.

Referenced by PackableStreamBuf::sync().

void ShmWriter::vappendf ( const char *  fmt,
va_list  ap 
)
overridevirtual

Append operation, with vsprintf(3)-style arguments.

Note
arguments may be evaluated more than once, be careful of side-effects

XXX: This method either should not exist or should not be virtual. Kids should not be forced to re-implement vappendf() logic. That logic should be implemented once, using other [Packable] APIs. Packable is not about providing a printf(3) service. Packable is about writing opaque data to various custom destinations.

Implements Packable.

Definition at line 108 of file MemStore.cc.

References append(), SBuf::length(), SBuf::rawContent(), and SBuf::vappendf().

Member Data Documentation

const char* ShmWriter::buf
private

Definition at line 70 of file MemStore.cc.

Referenced by append(), and copyToShmSlice().

int ShmWriter::bufSize
private

Definition at line 71 of file MemStore.cc.

Referenced by append(), copyToShm(), and copyToShmSlice().

int ShmWriter::bufWritten
private

Definition at line 72 of file MemStore.cc.

Referenced by append(), copyToShm(), and copyToShmSlice().

StoreEntry* ShmWriter::entry

Definition at line 50 of file MemStore.cc.

Referenced by copyToShm(), copyToShmSlice(), and ShmWriter().

const sfileno ShmWriter::fileNo
private

Definition at line 67 of file MemStore.cc.

Referenced by copyToShm().

Ipc::StoreMapSliceId ShmWriter::firstSlice

the slot keeping the first byte of the appended content (at least) either set via constructor parameter or allocated by the first append

Definition at line 54 of file MemStore.cc.

Referenced by copyToShm().

Ipc::StoreMapSliceId ShmWriter::lastSlice

Definition at line 57 of file MemStore.cc.

Referenced by copyToShm(), copyToShmSlice(), and MemStore::updateHeadersOrThrow().

MemStore& ShmWriter::store
private

Definition at line 66 of file MemStore.cc.

Referenced by copyToShm(), and copyToShmSlice().

uint64_t ShmWriter::totalWritten

Definition at line 59 of file MemStore.cc.

Referenced by copyToShm(), copyToShmSlice(), and MemStore::updateHeadersOrThrow().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors