|
Squid Web Cache master
|
Public Member Functions | |
| ShmWriter (MemStore &aStore, StoreEntry *anEntry, const sfileno aFileNo, Ipc::StoreMapSliceId aFirstSlice=-1) | |
| void | append (const char *aBuf, int aSize) override |
| Appends a c-string to existing packed data. | |
| void | vappendf (const char *fmt, va_list ap) override |
| void | appendf (const char *fmt,...) PRINTF_FORMAT_ARG2 |
| Append operation with printf-style arguments. | |
| virtual void | buffer () |
| virtual void | flush () |
Public Attributes | |
| StoreEntry * | entry |
| the entry being updated | |
| Ipc::StoreMapSliceId | firstSlice |
| Ipc::StoreMapSliceId | lastSlice |
| the slot keeping the last byte of the appended content (at least) | |
| uint64_t | totalWritten |
| cumulative number of bytes appended so far | |
Protected Member Functions | |
| void | copyToShm () |
| copies the entire buffer to shared memory | |
| void | copyToShmSlice (Ipc::StoreMap::Slice &slice) |
| copies at most one slice worth of buffer to shared memory | |
Private Attributes | |
| MemStore & | store |
| const sfileno | fileNo |
| const char * | buf |
| content being appended now | |
| int | bufSize |
| buf size | |
| int | bufWritten |
| buf bytes appended so far | |
Packs to shared memory, allocating new slots/pages as needed. Requires an Ipc::StoreMapAnchor locked for writing.
Definition at line 38 of file MemStore.cc.
| ShmWriter::ShmWriter | ( | MemStore & | aStore, |
| StoreEntry * | anEntry, | ||
| const sfileno | aFileNo, | ||
| Ipc::StoreMapSliceId | aFirstSlice = -1 |
||
| ) |
Definition at line 75 of file MemStore.cc.
|
overridevirtual |
Implements Packable.
Definition at line 90 of file MemStore.cc.
References buf, bufSize, bufWritten, copyToShm(), and Must.
Referenced by MemStore::updateHeadersOrThrow(), and vappendf().
|
inlineinherited |
Definition at line 61 of file Packable.h.
References Packable::vappendf().
Referenced by Ftp::Server::acceptDataConnection(), Format::Format::assemble(), HttpStateData::buildRequestPrefix(), clientPackRangeHdr(), clientPackTermBound(), ErrorState::compileLegacyCode(), EventScheduler::dump(), dump_cachemgrpasswd(), 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(), Ftp::Server::handleEpsvReply(), Ftp::Server::handlePasvReply(), helperDispatch(), httpHdrContRangePackInto(), httpHdrRangeRespSpecPackInto(), internalRemoteUri(), Adaptation::Icap::ModXact::makeAllowHeader(), Adaptation::Icap::OptXact::makeRequest(), Adaptation::Icap::ModXact::makeRequestHeaders(), Adaptation::Icap::ModXact::makeUsernameHeader(), memBufReport(), Adaptation::Icap::ModXact::openChunk(), Http::Stream::packChunk(), HttpRequest::packFirstLineInto(), Http::StatusLine::packInto(), HttpHdrCc::packInto(), HttpHdrScTarget::packInto(), HttpHdrRangeSpec::packInto(), Helper::Client::packStatsInto(), Ftp::PrintReply(), Ftp::Client::sendEprt(), Ftp::Client::sendPassive(), ACLExternal::startLookup(), MemObject::stat(), statStoreEntry(), AsyncJob::status(), BodyPipe::status(), Adaptation::Ecap::XactionRep::status(), Adaptation::Icap::ServiceRep::status(), Adaptation::Icap::Xaction::status(), Http::Tunneler::status(), Comm::TcpAcceptor::status(), Ipc::Inquirer::status(), Security::PeerConnector::status(), wordlistCat(), Ftp::Server::writeCustomReply(), Ftp::Server::writeEarlyReply(), Ftp::Server::writeErrorReply(), and Http::Tunneler::writeRequest().
|
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.
|
protected |
Definition at line 118 of file MemStore.cc.
References bufSize, bufWritten, copyToShmSlice(), debugs, entry, fileNo, firstSlice, lastSlice, Must, MemStore::nextAppendableSlice(), store, and totalWritten.
Referenced by append().
|
protected |
Definition at line 136 of file MemStore.cc.
References buf, bufSize, bufWritten, debugs, entry, lastSlice, Must, MemStore::pageForSlice(), Ipc::Mem::PageSize(), Ipc::StoreMapSlice::size, store, and totalWritten.
Referenced by copyToShm().
|
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.
|
overridevirtual |
Append operation, with vsprintf(3)-style arguments.
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 106 of file MemStore.cc.
References append(), SBuf::length(), SBuf::rawContent(), and SBuf::vappendf().
|
private |
Definition at line 68 of file MemStore.cc.
Referenced by append(), and copyToShmSlice().
|
private |
Definition at line 69 of file MemStore.cc.
Referenced by append(), copyToShm(), and copyToShmSlice().
|
private |
Definition at line 70 of file MemStore.cc.
Referenced by append(), copyToShm(), and copyToShmSlice().
| StoreEntry* ShmWriter::entry |
Definition at line 48 of file MemStore.cc.
Referenced by ShmWriter(), copyToShm(), and copyToShmSlice().
|
private |
Definition at line 65 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 52 of file MemStore.cc.
Referenced by copyToShm().
| Ipc::StoreMapSliceId ShmWriter::lastSlice |
Definition at line 55 of file MemStore.cc.
Referenced by copyToShm(), copyToShmSlice(), and MemStore::updateHeadersOrThrow().
|
private |
Definition at line 64 of file MemStore.cc.
Referenced by copyToShm(), and copyToShmSlice().
| uint64_t ShmWriter::totalWritten |
Definition at line 57 of file MemStore.cc.
Referenced by copyToShm(), copyToShmSlice(), and MemStore::updateHeadersOrThrow().