#include <StoreClient.h>

Classes | |
struct | Callback |
Public Member Functions | |
void * | operator new (size_t size) |
void | operator delete (void *address) |
void * | toCbdata () noexcept |
store_client (StoreEntry *) | |
~store_client () | |
int64_t | readOffset () const |
int | getType () const |
void | noteSwapInDone (bool error) |
void | doCopy (StoreEntry *e) |
void | readHeader (const char *buf, ssize_t len) |
void | readBody (const char *buf, ssize_t len) |
void | copy (StoreEntry *, StoreIOBuffer, STCB *, void *) |
void | dumpStats (MemBuf *output, int clientNumber) const |
int | bytesWanted () const |
void | setDelayId (DelayId delay_id) |
Public Attributes | |
int64_t | cmp_offset |
StoreEntry * | entry |
StoreIOState::Pointer | swapin_sio |
struct { | |
bool disk_io_pending | |
bool store_copying | |
} | flags |
DelayId | delayId |
dlink_node | node |
struct store_client::Callback | _callback |
Private Member Functions | |
bool | moreToSend () const |
Whether there is (or will be) more entry data for us. More... | |
void | fileRead () |
void | scheduleDiskRead () |
void | scheduleMemRead () |
void | scheduleRead () |
bool | startSwapin () |
opens the swapin "file" if possible; otherwise, fail()s and returns false More... | |
void | fail () |
void | callback (ssize_t) |
void | noteCopiedBytes (size_t) |
void | noteEof () |
void | noteNews () |
if necessary and possible, informs the Store reader about copy() result More... | |
void | finishCallback () |
finishes a copy()-STCB sequence by synchronously calling STCB More... | |
Static Private Member Functions | |
static void | FinishCallback (store_client *) |
finishCallback() wrapper; TODO: Add NullaryMemFunT for non-jobs. More... | |
Private Attributes | |
int | type |
bool | object_ok |
StoreIOBuffer | copyInto |
size_t | copiedSize |
Static Private Attributes | |
static cbdata_type | CBDATA_store_client = CBDATA_UNKNOWN |
Detailed Description
Definition at line 56 of file StoreClient.h.
Constructor & Destructor Documentation
◆ store_client()
store_client::store_client | ( | StoreEntry * | e | ) |
Definition at line 209 of file store_client.cc.
References assert, entry, flags, getType(), StoreEntry::hasDisk(), StoreEntry::refcount, STORE_DISK_CLIENT, and StoreEntry::swapoutFailed().
◆ ~store_client()
store_client::~store_client | ( | ) |
Definition at line 230 of file store_client.cc.
Member Function Documentation
◆ bytesWanted()
int store_client::bytesWanted | ( | ) | const |
The maximum number of bytes the Store client can read/copy next without overflowing its buffer and without violating delay pool limits. Store I/O is not rate-limited, but we assume that the same number of bytes may be read from the Squid-to-server connection that may be rate-limited.
Definition at line 947 of file store_client.cc.
References DelayId::bytesWanted(), copyInto, delayId, and StoreIOBuffer::length.
◆ callback()
|
private |
schedules asynchronous STCB call to relay disk or memory read results
- Parameters
-
outcome an error signal (if negative), an EOF signal (if zero), or the number of bytes read
Definition at line 145 of file store_client.cc.
References fail(), noteCopiedBytes(), and noteEof().
Referenced by readBody(), and scheduleMemRead().
◆ copy()
void store_client::copy | ( | StoreEntry * | anEntry, |
StoreIOBuffer | copyRequest, | ||
STCB * | callback_fn, | ||
void * | data | ||
) |
Request StoreIOBuffer-described response data via an asynchronous STCB callback. At most one outstanding request is allowed per store_client.
Definition at line 246 of file store_client.cc.
References _callback, assert, cbdataReference, cmp_offset, copyInto, StoreIOBuffer::data, debugs, EBIT_TEST, entry, ENTRY_ABORTED, StoreEntry::flags, StoreEntry::getMD5Text(), StoreEntry::kickProducer(), MemObject::kickReads(), StoreIOBuffer::length, StoreEntry::lock(), StoreEntry::mem_obj, StoreIOBuffer::offset, store_client::Callback::pending(), storeClientCopy2(), and StoreEntry::unlock().
◆ doCopy()
void store_client::doCopy | ( | StoreEntry * | e | ) |
Definition at line 355 of file store_client.cc.
References _callback, assert, Assure, copyInto, debugs, MemObject::endOffset(), entry, flags, getType(), StoreEntry::mem_obj, moreToSend(), noteEof(), StoreIOBuffer::offset, store_client::Callback::pending(), scheduleRead(), startSwapin(), STORE_DISK_CLIENT, STORE_PENDING, StoreEntry::store_status, and swapin_sio.
◆ dumpStats()
Definition at line 910 of file store_client.cc.
References _callback, MemBuf::append(), Packable::appendf(), store_client::Callback::callback_data, copyInto, flags, StoreIOBuffer::length, store_client::Callback::notifier, StoreIOBuffer::offset, store_client::Callback::pending(), and PRId64.
Referenced by StoreClientStats::operator()().
◆ fail()
|
private |
Definition at line 545 of file store_client.cc.
References debugs, noteNews(), and object_ok.
Referenced by callback(), noteSwapInDone(), readBody(), readHeader(), and startSwapin().
◆ fileRead()
|
private |
Definition at line 488 of file store_client.cc.
References _callback, assert, copyInto, StoreIOBuffer::data, entry, flags, StoreIOBuffer::length, StoreEntry::mem_obj, StoreIOBuffer::offset, StoreIOState::offset(), store_client::Callback::pending(), MemObject::SwapOut::sio, storeClientReadBody, storeClientReadHeader, storeRead(), MemObject::swap_hdr_sz, swapin_sio, MemObject::swapout, and StoreEntry::swappingOut().
Referenced by readHeader(), and scheduleDiskRead().
◆ finishCallback()
|
private |
Definition at line 165 of file store_client.cc.
References _callback, Assure, store_client::Callback::callback_data, store_client::Callback::callback_handler, cbdataReferenceDone, cbdataReferenceValid(), cmp_offset, copiedSize, copyInto, StoreIOBuffer::data, StoreIOBuffer::error, StoreIOBuffer::flags, StoreIOBuffer::length, store_client::Callback::notifier, object_ok, and StoreIOBuffer::offset.
◆ FinishCallback()
|
staticprivate |
◆ getType()
int store_client::getType | ( | ) | const |
Definition at line 88 of file store_client.cc.
References type.
Referenced by store_client(), doCopy(), LowestMemReader::operator()(), and scheduleDiskRead().
◆ moreToSend()
|
private |
Definition at line 303 of file store_client.cc.
References copyInto, MemObject::endOffset(), entry, StoreEntry::hasDisk(), MemObject::inmem_lo, StoreEntry::mem_obj, StoreEntry::objectLen(), StoreIOBuffer::offset, STORE_PENDING, and StoreEntry::store_status.
Referenced by doCopy().
◆ noteCopiedBytes()
|
private |
schedules asynchronous STCB call to relay a successful disk or memory read
- Parameters
-
bytesCopied the number of response bytes copied into copyInto
Definition at line 192 of file store_client.cc.
References Assure, copiedSize, debugs, and noteNews().
Referenced by callback().
◆ noteEof()
|
private |
Definition at line 202 of file store_client.cc.
References Assure, copiedSize, debugs, and noteNews().
Referenced by callback(), doCopy(), and noteSwapInDone().
◆ noteNews()
|
private |
Definition at line 558 of file store_client.cc.
References _callback, Assure, asyncCall(), store_client::Callback::callback_handler, cbdataDialer(), debugs, FinishCallback(), store_client::Callback::notifier, store_client::Callback::pending(), and ScheduleCallHere.
Referenced by fail(), noteCopiedBytes(), and noteEof().
◆ noteSwapInDone()
void store_client::noteSwapInDone | ( | bool | error | ) |
React to the end of reading the response from disk. There will be no more readHeader() and readBody() callbacks for the current storeRead() swapin after this notification.
Definition at line 434 of file store_client.cc.
References _callback, Assure, error(), fail(), noteEof(), and store_client::Callback::pending().
◆ operator delete()
|
inline |
Definition at line 58 of file StoreClient.h.
◆ operator new()
|
inline |
Definition at line 58 of file StoreClient.h.
◆ readBody()
void store_client::readBody | ( | const char * | buf, |
ssize_t | len | ||
) |
Definition at line 510 of file store_client.cc.
References _callback, MemObject::adjustableBaseReply(), assert, MemObject::baseReply(), callback(), Config, copyInto, StoreIOBuffer::data, DBG_CRITICAL, debugs, MemObject::endOffset(), entry, fail(), flags, headersEnd(), MemObject::inmem_lo, SquidConfig::maxInMemObjSize, StoreEntry::mem(), StoreEntry::mem_obj, SquidConfig::memory_cache_disk, StoreEntry::objectLen(), StoreIOBuffer::offset, SquidConfig::onoff, Http::Message::parseCharBuf(), store_client::Callback::pending(), Http::scNone, SquidConfig::Store, storeGetMemSpace(), and MemObject::write().
Referenced by readHeader().
◆ readHeader()
void store_client::readHeader | ( | const char * | buf, |
ssize_t | len | ||
) |
Definition at line 598 of file store_client.cc.
References _callback, assert, copyInto, CurrentException(), StoreIOBuffer::data, DBG_IMPORTANT, debugs, entry, fail(), fileRead(), flags, StoreIOBuffer::length, StoreEntry::mem_obj, min(), object_ok, StoreIOBuffer::offset, store_client::Callback::pending(), readBody(), MemObject::swap_hdr_sz, and Store::UnpackHitSwapMeta().
◆ readOffset()
|
inline |
An offset into the stored response bytes, including the HTTP response headers (if any). Note that this offset does not include Store entry metadata, because it is not a part of the stored response.
- Return values
-
0 means the client wants to read HTTP response headers. +N the response byte that the client wants to read next. -N should not occur.
Definition at line 72 of file StoreClient.h.
References copyInto, and StoreIOBuffer::offset.
Referenced by LowestMemReader::operator()().
◆ scheduleDiskRead()
|
private |
Definition at line 455 of file store_client.cc.
References assert, debugs, entry, fileRead(), flags, getType(), startSwapin(), STORE_DISK_CLIENT, and swapin_sio.
Referenced by scheduleRead().
◆ scheduleMemRead()
|
private |
Definition at line 477 of file store_client.cc.
References callback(), mem_hdr::copy(), copyInto, MemObject::data_hdr, debugs, entry, flags, and StoreEntry::mem_obj.
Referenced by scheduleRead().
◆ scheduleRead()
|
private |
Definition at line 444 of file store_client.cc.
References copyInto, MemObject::endOffset(), entry, MemObject::inmem_lo, StoreEntry::mem_obj, StoreIOBuffer::offset, scheduleDiskRead(), and scheduleMemRead().
Referenced by doCopy().
◆ setDelayId()
void store_client::setDelayId | ( | DelayId | delay_id | ) |
Definition at line 954 of file store_client.cc.
References delayId.
Referenced by Ssl::ServerBump::ServerBump(), clientReplyContext::createStoreEntry(), clientReplyContext::doGetMoreData(), clientReplyContext::processExpired(), clientReplyContext::sendMoreData(), and clientReplyContext::setReplyToStoreEntry().
◆ startSwapin()
|
private |
Definition at line 405 of file store_client.cc.
References DBG_IMPORTANT, debugs, fail(), flags, storeSwapInStart(), storeTooManyDiskFilesOpen(), and swapin_sio.
Referenced by doCopy(), and scheduleDiskRead().
◆ toCbdata()
|
inlinenoexcept |
Definition at line 58 of file StoreClient.h.
Member Data Documentation
◆ _callback
struct store_client::Callback store_client::_callback |
Referenced by copy(), doCopy(), dumpStats(), fileRead(), finishCallback(), noteNews(), noteSwapInDone(), readBody(), and readHeader().
◆ CBDATA_store_client
|
staticprivate |
Definition at line 58 of file StoreClient.h.
◆ cmp_offset
int64_t store_client::cmp_offset |
Definition at line 91 of file StoreClient.h.
Referenced by copy(), and finishCallback().
◆ copiedSize
|
private |
The number of bytes loaded from Store into copyInto while answering the current copy() request. Ought to be ignored when not answering.
Definition at line 151 of file StoreClient.h.
Referenced by finishCallback(), noteCopiedBytes(), and noteEof().
◆ copyInto
|
private |
Storage and metadata associated with the current copy() request. Ought to be ignored when not answering a copy() request.
Definition at line 147 of file StoreClient.h.
Referenced by bytesWanted(), copy(), doCopy(), dumpStats(), fileRead(), finishCallback(), moreToSend(), readBody(), readHeader(), readOffset(), scheduleMemRead(), and scheduleRead().
◆ delayId
DelayId store_client::delayId |
Definition at line 112 of file StoreClient.h.
Referenced by bytesWanted(), and setDelayId().
◆ disk_io_pending
bool store_client::disk_io_pending |
whether we are expecting a response to be swapped in from disk (i.e. whether async storeRead() is currently in progress)
Definition at line 104 of file StoreClient.h.
◆ entry
StoreEntry* store_client::entry |
Definition at line 97 of file StoreClient.h.
Referenced by store_client(), copy(), doCopy(), fileRead(), moreToSend(), readBody(), readHeader(), scheduleDiskRead(), scheduleMemRead(), and scheduleRead().
◆
struct { ... } store_client::flags |
Referenced by store_client(), doCopy(), dumpStats(), fileRead(), readBody(), readHeader(), scheduleDiskRead(), scheduleMemRead(), and startSwapin().
◆ node
dlink_node store_client::node |
Definition at line 123 of file StoreClient.h.
Referenced by MemObject::addClient().
◆ object_ok
|
private |
Definition at line 143 of file StoreClient.h.
Referenced by fail(), finishCallback(), and readHeader().
◆ store_copying
bool store_client::store_copying |
whether the store_client::doCopy()-initiated STCB sequence is currently in progress
Definition at line 108 of file StoreClient.h.
◆ swapin_sio
StoreIOState::Pointer store_client::swapin_sio |
Definition at line 98 of file StoreClient.h.
Referenced by doCopy(), fileRead(), scheduleDiskRead(), and startSwapin().
◆ type
|
private |
Definition at line 142 of file StoreClient.h.
Referenced by getType().
The documentation for this class was generated from the following files:
- src/StoreClient.h
- src/store_client.cc