#include <MemObject.h>

Collaboration diagram for MemObject:


class  MemCache
 State of an entry with regards to the [shared] memory caching. More...
class  SwapOut
class  XitTable
 State of an entry with regards to the [shared] in-transit table. More...

Public Types

using Io = Store::IoStatus

Public Member Functions

void dump () const
 MemObject ()
 ~MemObject ()
void setUris (char const *aStoreId, char const *aLogUri, const HttpRequestMethod &aMethod)
bool hasUris () const
 whether setUris() has been called More...
void write (const StoreIOBuffer &buf)
void unlinkRequest ()
const HttpReplybaseReply () const
const HttpReplyPointerupdatedReply () const
const HttpReplyfreshestReply () const
HttpReplyadjustableBaseReply ()
void replaceBaseReply (const HttpReplyPointer &r)
void updateReply (const HttpReply &r)
 (re)sets updated reply; More...
void stat (MemBuf *mb) const
int64_t endOffset () const
void markEndOfReplyHeaders ()
 sets baseReply().hdr_sz (i.e. written reply headers size) to endOffset() More...
int64_t expectedReplySize () const
int64_t size () const
void reset ()
int64_t lowestMemReaderOffset () const
bool readAheadPolicyCanRead () const
void addClient (store_client *)
int64_t objectBytesOnDisk () const
int64_t policyLowestOffsetToKeep (bool swap) const
int64_t availableForSwapOut () const
 buffered bytes we have not swapped out yet More...
void trimSwappable ()
void trimUnSwappable ()
bool isContiguous () const
int mostBytesWanted (int max, bool ignoreDelayPools) const
void setNoDelay (bool const newValue)
DelayId mostBytesAllowed () const
const char * urlXXX () const
const char * storeId () const
const char * logUri () const
 client request URI used for logging; storeId() by default More...
size_t clientCount () const
bool clientIsFirst (void *sc) const
void delayRead (const AsyncCallPointer &)
void kickReads ()

Static Public Member Functions

static size_t inUseCount ()

Public Attributes

bool appliedUpdates = false
HttpRequestMethod method
mem_hdr data_hdr
int64_t inmem_lo = 0
dlink_list clients
int nclients = 0
SwapOut swapout
XitTable xitTable
 current [shared] memory caching state for the entry More...
MemCache memCache
 current [shared] memory caching state for the entry More...
HttpRequestPointer request
struct timeval start_ping
PeerSelectorircb_data = nullptr
AsyncCallPointer abortCallback
 used for notifying StoreEntry writers about 3rd-party initiated aborts More...
RemovalPolicyNode repl
int id = 0
int64_t object_sz = -1
size_t swap_hdr_sz = 0
SBuf vary_headers

Static Public Attributes

static constexpr Io ioUndecided = Store::ioUndecided
static constexpr Io ioReading = Store::ioReading
static constexpr Io ioWriting = Store::ioWriting
static constexpr Io ioDone = Store::ioDone

Private Member Functions


Private Attributes

HttpReplyPointer reply_
HttpReplyPointer updatedReply_
String storeId_
 StoreId for our entry (usually request URI) More...
String logUri_
 URI used for logging (usually request URI) More...
DelayedAsyncCalls deferredReads

Detailed Description

Definition at line 33 of file MemObject.h.

Member Typedef Documentation

◆ Io

Definition at line 172 of file MemObject.h.

Constructor & Destructor Documentation

◆ MemObject()

MemObject::MemObject ( )

Definition at line 97 of file MemObject.cc.

References debugs, ping_reply_callback, reply_, and start_ping.

◆ ~MemObject()

Member Function Documentation

◆ addClient()

void MemObject::addClient ( store_client aClient)

Definition at line 303 of file MemObject.cc.

References clients, dlinkAdd(), nclients, and store_client::node.

Referenced by storeClientListAdd().

◆ adjustableBaseReply()

HttpReply & MemObject::adjustableBaseReply ( )
writable base reply for parsing and other initial modifications Base modifications can only be done when forming/loading the entry. After that, use replaceBaseReply() to reset all of the replies.

Definition at line 121 of file MemObject.cc.

References assert, reply_, and updatedReply_.

Referenced by MemStore::copyFromShm(), TestRock::createEntry(), TestUfs::testUfsSearch(), and store_client::tryParsingHttpHeaders().

◆ availableForSwapOut()

int64_t MemObject::availableForSwapOut ( ) const

◆ baseReply()

◆ clientCount()

size_t MemObject::clientCount ( ) const

Definition at line 152 of file MemObject.h.

References nclients.

Referenced by storeUnregister().

◆ clientIsFirst()

bool MemObject::clientIsFirst ( void *  sc) const

Definition at line 154 of file MemObject.h.

References clients, dlink_node::data, dlink_list::head, and sc.

◆ delayRead()

void MemObject::delayRead ( const AsyncCallPointer aRead)

◆ dump()

void MemObject::dump ( ) const

◆ endOffset()

int64_t MemObject::endOffset ( ) const

The offset of the last memory-stored HTTP response byte plus one.

  • HTTP response headers (if any) are stored at offset zero.
  • HTTP response body byte[n] usually has offset (hdr_sz + n), where hdr_sz is the size of stored HTTP response headers (zero if none); and n is the corresponding byte offset in the whole resource body. However, some 206 (Partial Content) response bodies are stored (and retrieved) as regular 200 response bodies, disregarding offsets of their body parts.
    See also

Definition at line 214 of file MemObject.cc.

References data_hdr, and mem_hdr::endOffset().

Referenced by StoreEntry::append(), availableForSwapOut(), store_client::canReadFromMemory(), CheckQuickAbortIsReasonable(), StoreEntry::checkTooBig(), StoreEntry::complete(), MemStore::copyFromShm(), MemStore::copyFromShmSlice(), MemStore::copyToShm(), store_client::doCopy(), doPages(), isContiguous(), StoreEntry::isEmpty(), Store::Controller::keepForLocalMemoryCache(), lowestMemReaderOffset(), markEndOfReplyHeaders(), store_client::maybeWriteFromDiskToMemory(), StoreEntry::mayStartSwapOut(), objectSizeForDirSelection(), policyLowestOffsetToKeep(), readAheadPolicyCanRead(), MemStore::shouldCache(), size(), StoreEntry::storeClientType(), and StoreEntry::swapOut().

◆ expectedReplySize()

int64_t MemObject::expectedReplySize ( ) const

negative if unknown; otherwise, expected object_sz, expected endOffset maximum, and stored reply headers+body size (all three are the same)

Definition at line 238 of file MemObject.cc.

References baseReply(), HttpReply::bodySize(), debugs, Http::Message::hdr_sz, method, and object_sz.

Referenced by Store::Controller::keepForLocalMemoryCache(), StoreEntry::mayStartSwapOut(), objectSizeForDirSelection(), Store::PackFields(), MemStore::shouldCache(), and MemStore::startCaching().

◆ freshestReply()

◆ hasUris()

bool MemObject::hasUris ( ) const

Definition at line 70 of file MemObject.cc.

References String::size(), and storeId_.

Referenced by StoreEntry::forcePublicKey(), StoreEntry::setPrivateKey(), setUris(), and storeLog().

◆ inUseCount()

size_t MemObject::inUseCount ( )

Definition at line 47 of file MemObject.cc.

Referenced by Store::Controller::getStats().

◆ isContiguous()

bool MemObject::isContiguous ( ) const

◆ kickReads()

void MemObject::kickReads ( )

Definition at line 459 of file MemObject.cc.

References deferredReads, and DelayedAsyncCalls::schedule().

Referenced by store_client::copy(), and storeUnregister().

◆ logUri()

const char * MemObject::logUri ( ) const

Definition at line 64 of file MemObject.cc.

References logUri_, String::size(), storeId(), and String::termedBuf().

Referenced by StoreEntry::adjustVary(), stat(), and storeLog().

◆ lowestMemReaderOffset()

int64_t MemObject::lowestMemReaderOffset ( ) const

◆ markEndOfReplyHeaders()

void MemObject::markEndOfReplyHeaders ( )

Definition at line 220 of file MemObject.cc.

References assert, endOffset(), Http::Message::hdr_sz, and reply_.

Referenced by StoreEntry::startWriting().


MemObject::MEMPROXY_CLASS ( MemObject  )

◆ mostBytesAllowed()

DelayId MemObject::mostBytesAllowed ( ) const

◆ mostBytesWanted()

int MemObject::mostBytesWanted ( int  max,
bool  ignoreDelayPools 
) const

Definition at line 415 of file MemObject.cc.

References DelayId::bytesWanted(), max(), and mostBytesAllowed().

Referenced by StoreEntry::bytesWanted().

◆ objectBytesOnDisk()

int64_t MemObject::objectBytesOnDisk ( ) const

◆ policyLowestOffsetToKeep()

int64_t MemObject::policyLowestOffsetToKeep ( bool  swap) const

◆ readAheadPolicyCanRead()

bool MemObject::readAheadPolicyCanRead ( ) const

◆ replaceBaseReply()

void MemObject::replaceBaseReply ( const HttpReplyPointer r)

(re)sets base reply, usually just replacing the initial/empty object also forgets the updated reply (if any)

Definition at line 128 of file MemObject.cc.

References assert, reply_, and updatedReply_.

Referenced by StoreEntry::replaceHttpReply().

◆ reset()

void MemObject::reset ( )

◆ setNoDelay()

void MemObject::setNoDelay ( bool const  newValue)

Definition at line 431 of file MemObject.cc.

References clients, dlink_list::head, node::next, and sc.

Referenced by StoreEntry::setNoDelay().

◆ setUris()

void MemObject::setUris ( char const *  aStoreId,
char const *  aLogUri,
const HttpRequestMethod aMethod 

Sets store ID, log URI, and request method (unless already set). Does not clobber the method so that, say, a HEAD hit for a GET entry keeps the GET method that matches the entry key. Same for the other parts of the trio because the entry filling code may expect them to be constant. XXX: Avoid this method. We plan to remove it and make the trio constant after addressing the XXX in MemStore::get().

Definition at line 76 of file MemObject.cc.

References String::clean(), debugs, hasUris(), logUri_, method, storeId_, and urlXXX().

Referenced by StoreEntry::ensureMemObject().

◆ size()

int64_t MemObject::size ( ) const

Definition at line 229 of file MemObject.cc.

References endOffset(), and object_sz.

Referenced by peerDigestFetchSetStats().

◆ stat()

◆ storeId()

const char * MemObject::storeId ( ) const

Entry StoreID (usually just Request URI); if a buggy code requests this before the information is available, returns an "[unknown_URI]" string.

Definition at line 53 of file MemObject.cc.

References DBG_IMPORTANT, debugs, dump(), String::size(), storeId_, and String::termedBuf().

Referenced by StoreEntry::adjustVary(), clientReplyContext::cacheHit(), StoreEntry::calcPublicKey(), findPreviouslyCachedEntry(), HeapKeyGen_StoreEntry_GDSF(), HeapKeyGen_StoreEntry_LFUDA(), HeapKeyGen_StoreEntry_LRU(), httpMaybeRemovePublic(), logUri(), refreshCheck(), StoreEntry::url(), and urlXXX().

◆ trimSwappable()

void MemObject::trimSwappable ( )

◆ trimUnSwappable()

void MemObject::trimUnSwappable ( )

◆ unlinkRequest()

void MemObject::unlinkRequest ( )

Definition at line 56 of file MemObject.h.

References request.

Referenced by Store::Controller::handleIdleEntry(), and storeDigestRewriteFinish().

◆ updatedReply()

const HttpReplyPointer & MemObject::updatedReply ( ) const
nil – if no 304 updates since replaceBaseReply()
combination of baseReply() and 304 updates – after updates

Definition at line 64 of file MemObject.h.

References updatedReply_.

Referenced by StoreEntry::startWriting().

◆ updateReply()

void MemObject::updateReply ( const HttpReply r)
See also

Definition at line 85 of file MemObject.h.

References updatedReply_.

Referenced by StoreEntry::updateOnNotModified().

◆ urlXXX()

const char * MemObject::urlXXX ( ) const

Before StoreID, code assumed that MemObject stores Request URI. After StoreID, some old code still incorrectly assumes that. Use this method to mark that incorrect assumption.

Definition at line 138 of file MemObject.h.

References storeId().

Referenced by setUris(), and varyEvaluateMatch().

◆ write()

Member Data Documentation

◆ abortCallback

AsyncCallPointer MemObject::abortCallback

◆ appliedUpdates

bool MemObject::appliedUpdates = false

reflects past Controller::updateOnNotModified(old, e304) calls: for HTTP 304 entries: whether our entry was used as "e304" for other entries: whether our entry was updated as "old"

Definition at line 90 of file MemObject.h.

Referenced by dump(), reset(), StoreEntry::updateOnNotModified(), and Store::Controller::updateOnNotModified().

◆ clients

◆ data_hdr

◆ deferredReads

DelayedAsyncCalls MemObject::deferredReads

Definition at line 240 of file MemObject.h.

Referenced by delayRead(), and kickReads().

◆ id

int MemObject::id = 0

Definition at line 221 of file MemObject.h.

Referenced by peerCountMcastPeersCreateAndSend(), and StoreEntry::setPrivateKey().

◆ inmem_lo

◆ ioDone

constexpr Io MemObject::ioDone = Store::ioDone

◆ ioReading

constexpr Io MemObject::ioReading = Store::ioReading

Definition at line 174 of file MemObject.h.

Referenced by MemStore::anchorEntry(), MemStore::disconnect(), and MemStore::write().

◆ ioUndecided

constexpr Io MemObject::ioUndecided = Store::ioUndecided

Definition at line 173 of file MemObject.h.

Referenced by MemStore::write().

◆ ioWriting

constexpr Io MemObject::ioWriting = Store::ioWriting

Definition at line 175 of file MemObject.h.

Referenced by MemStore::disconnect(), MemStore::startCaching(), and MemStore::write().

◆ ircb_data

PeerSelector* MemObject::ircb_data = nullptr

◆ logUri_

String MemObject::logUri_

Definition at line 238 of file MemObject.h.

Referenced by dump(), logUri(), and setUris().

◆ memCache

◆ method

◆ nclients

◆ object_sz

◆ ping_reply_callback

IRCB* MemObject::ping_reply_callback

◆ repl

◆ reply_

HttpReplyPointer MemObject::reply_

◆ request

◆ start_ping

struct timeval MemObject::start_ping

◆ storeId_

String MemObject::storeId_

Definition at line 237 of file MemObject.h.

Referenced by dump(), hasUris(), setUris(), and storeId().

◆ swap_hdr_sz

◆ swapout

◆ updatedReply_

HttpReplyPointer MemObject::updatedReply_

◆ vary_headers

◆ xitTable

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






Web Site Translations