#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

enum  Io {
 cache "I/O" direction and status More...

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 HttpReplyPointergetReply () const
void replaceReply (const HttpReplyPointer &r)
void stat (MemBuf *mb) const
int64_t endOffset () const
void markEndOfReplyHeaders ()
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 (DeferredRead const &)
void kickReads ()

Static Public Member Functions

static size_t inUseCount ()

Public Attributes

HttpRequestMethod method
mem_hdr data_hdr
int64_t inmem_lo
dlink_list clients
int nclients
SwapOut swapout
XitTable xitTable
 current [shared] memory caching state for the entry More...
MemCache memCache
 current [shared] memory caching state for the entry More...
bool smpCollapsed
 whether this entry gets data from another worker More...
HttpRequestPointer request
struct timeval start_ping
void * ircb_data
struct {
   STABH *   callback
   void *   data
RemovalPolicyNode repl
int id
int64_t object_sz
size_t swap_hdr_sz
SBuf vary_headers

Private Member Functions


Private Attributes

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

Detailed Description

Definition at line 31 of file MemObject.h.

Member Enumeration Documentation


Definition at line 127 of file MemObject.h.

Constructor & Destructor Documentation

MemObject::MemObject ( )

Definition at line 98 of file MemObject.cc.

References abort, debugs, reply_, and start_ping.

Member Function Documentation

void MemObject::addClient ( store_client aClient)

Definition at line 309 of file MemObject.cc.

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

Referenced by storeClientListAdd().

int64_t MemObject::availableForSwapOut ( ) const
size_t MemObject::clientCount ( ) const

Definition at line 105 of file MemObject.h.

References nclients.

Referenced by storeUnregister().

bool MemObject::clientIsFirst ( void *  sc) const

Definition at line 107 of file MemObject.h.

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

void MemObject::delayRead ( DeferredRead const &  aRead)
void MemObject::dump ( ) const
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 256 of file MemObject.cc.

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

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

bool MemObject::hasUris ( ) const
size_t MemObject::inUseCount ( )

Definition at line 48 of file MemObject.cc.

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

bool MemObject::isContiguous ( ) const
void MemObject::kickReads ( )

Definition at line 456 of file MemObject.cc.

References deferredReads, and DeferredReadManager::kickReads().

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

const char * MemObject::logUri ( ) const

Definition at line 65 of file MemObject.cc.

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

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

int64_t MemObject::lowestMemReaderOffset ( ) const
void MemObject::markEndOfReplyHeaders ( )

sets reply_->hdr_sz to endOffset()

Definition at line 238 of file MemObject.cc.

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

Referenced by StoreEntry::startWriting().

MemObject::MEMPROXY_CLASS ( MemObject  )
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().

int64_t MemObject::objectBytesOnDisk ( ) const
int64_t MemObject::policyLowestOffsetToKeep ( bool  swap) const
bool MemObject::readAheadPolicyCanRead ( ) const
void MemObject::replaceReply ( const HttpReplyPointer r)

Definition at line 56 of file MemObject.h.

References reply_.

Referenced by StoreEntry::replaceHttpReply().

void MemObject::reset ( )
void MemObject::setNoDelay ( bool const  newValue)
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 77 of file MemObject.cc.

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

Referenced by StoreEntry::ensureMemObject().

int64_t MemObject::size ( ) const

Definition at line 247 of file MemObject.cc.

References endOffset(), and object_sz.

Referenced by peerDigestFetchSetStats().

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 54 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().

void MemObject::trimSwappable ( )
void MemObject::trimUnSwappable ( )
void MemObject::unlinkRequest ( )

Definition at line 54 of file MemObject.h.

References request.

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

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 91 of file MemObject.h.

References storeId().

Referenced by StoreMetaURL::checkConsistency(), HttpStateData::haveParsedReplyHeaders(), HttpStateData::processReplyHeader(), setUris(), varyEvaluateMatch(), and ~MemObject().

void MemObject::write ( const StoreIOBuffer buf)

Member Data Documentation

struct { ... } MemObject::abort
STABH* MemObject::callback
void* MemObject::data
DeferredReadManager MemObject::deferredReads

Definition at line 187 of file MemObject.h.

Referenced by delayRead(), and kickReads().

int MemObject::id

Definition at line 168 of file MemObject.h.

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

void* MemObject::ircb_data
String MemObject::logUri_

Definition at line 185 of file MemObject.h.

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

IRCB* MemObject::ping_reply_callback
HttpReplyPointer MemObject::reply_
struct timeval MemObject::start_ping
String MemObject::storeId_

Definition at line 184 of file MemObject.h.

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

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






Web Site Translations