#include <Controller.h>

Inheritance diagram for Store::Controller:
Collaboration diagram for Store::Controller:

Public Member Functions

 Controller ()
 
virtual ~Controller () override
 
virtual void create () override
 create system resources needed for this store to operate in the future More...
 
virtual void init () override
 
virtual StoreEntryget (const cache_key *) override
 Retrieve a store entry from the store (blocking) More...
 
virtual uint64_t maxSize () const override
 
virtual uint64_t minSize () const override
 the minimum size the store will shrink to via normal housekeeping More...
 
virtual uint64_t currentSize () const override
 current size More...
 
virtual uint64_t currentCount () const override
 the total number of objects stored right now More...
 
virtual int64_t maxObjectSize () const override
 the maximum size of a storable object; -1 if unlimited More...
 
virtual void getStats (StoreInfoStats &stats) const override
 collect statistics More...
 
virtual void stat (StoreEntry &) const override
 
virtual void sync () override
 prepare for shutdown More...
 
virtual void maintain () override
 perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain More...
 
virtual void markForUnlink (StoreEntry &) override
 expect an unlink() call after the entry becomes idle More...
 
virtual void unlink (StoreEntry &) override
 remove the entry from the store More...
 
virtual int callback () override
 called once every main loop iteration; TODO: Move to UFS code. More...
 
virtual bool smpAware () const override
 
int64_t accumulateMore (StoreEntry &) const
 
void updateLimits ()
 slowly calculate (and cache) hi/lo watermarks and similar limits More...
 
void handleIdleEntry (StoreEntry &)
 called when the entry is no longer needed by any transaction More...
 
void memoryOut (StoreEntry &, const bool preserveSwappable)
 called to get rid of no longer needed entry data in RAM, if any More...
 
void updateOnNotModified (StoreEntry *old, const StoreEntry &newer)
 update old entry metadata and HTTP headers using a newer entry More...
 
void allowCollapsing (StoreEntry *, const RequestFlags &, const HttpRequestMethod &)
 makes the entry available for collapsing future requests More...
 
void transientsCompleteWriting (StoreEntry &)
 marks the entry completed for collapsed requests More...
 
void syncCollapsed (const sfileno)
 Update local intransit entry after changes made by appending worker. More...
 
void transientsAbandon (StoreEntry &)
 calls Root().transients->abandon() if transients are tracked More...
 
int transientReaders (const StoreEntry &) const
 number of the transient entry readers some time ago More...
 
void transientsDisconnect (MemObject &)
 disassociates the entry from the intransit table More...
 
void memoryUnlink (StoreEntry &)
 removes the entry from the memory cache More...
 
void memoryDisconnect (StoreEntry &)
 disassociates the entry from the memory cache, preserving cached data More...
 
StoreSearchsearch ()
 

Static Public Attributes

static int store_dirs_rebuilding = 1
 the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding More...
 

Private Member Functions

void referenceBusy (StoreEntry &e)
 update reference counters of the recently touched entry More...
 
bool dereferenceIdle (StoreEntry &, bool wantsLocalMemory)
 dereference() an idle entry and return true if the entry should be deleted More...
 
StoreEntryfind (const cache_key *key)
 
bool keepForLocalMemoryCache (StoreEntry &e) const
 whether e should be kept in local RAM for possible future caching More...
 
bool anchorCollapsed (StoreEntry &, bool &inSync)
 

Private Attributes

DisksswapDir
 summary view of all disk caches More...
 
MemorymemStore
 memory cache More...
 
Transientstransients
 

Detailed Description

Public Store interface. Coordinates the work of memory/disk/transient stores and hides their individual existence/differences from the callers.

Definition at line 22 of file Controller.h.

Constructor & Destructor Documentation

Store::Controller::Controller ( )

Definition at line 36 of file Controller.cc.

References assert, and store_table.

Store::Controller::~Controller ( )
overridevirtual

Definition at line 44 of file Controller.cc.

References destroyStoreEntry, hashFreeItems(), hashFreeMemory(), and store_table.

Member Function Documentation

int64_t Store::Controller::accumulateMore ( StoreEntry entry) const

Additional unknown-size entry bytes required by Store in order to reduce the risk of selecting the wrong disk cache for the growing entry.

Definition at line 348 of file Controller.cc.

Referenced by StoreEntry::mayStartSwapOut().

void Store::Controller::allowCollapsing ( StoreEntry e,
const RequestFlags reqFlags,
const HttpRequestMethod reqMethod 
)
bool Store::Controller::anchorCollapsed ( StoreEntry collapsed,
bool &  inSync 
)
private

Called for in-transit entries that are not yet anchored to a cache. For cached entries, return true after synchronizing them with their cache (making inSync true on success). For not-yet-cached entries, return false.

Definition at line 581 of file Controller.cc.

References assert, debugs, MemObject::XitTable::index, StoreEntry::mem_obj, MemObject::smpCollapsed, and MemObject::xitTable.

int Store::Controller::callback ( )
overridevirtual

Reimplemented from Store::Storage.

Reimplemented in TestStore.

Definition at line 223 of file Controller.cc.

References PROF_start, and PROF_stop.

Referenced by StoreRootEngine::checkEvents(), and DiskdIOStrategy::SEND().

void Store::Controller::create ( )
overridevirtual

Implements Store::Storage.

Definition at line 75 of file Controller.cc.

References pid, and WaitForAnyPid().

Referenced by SquidMain().

uint64_t Store::Controller::currentCount ( ) const
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 174 of file Controller.cc.

uint64_t Store::Controller::currentSize ( ) const
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 167 of file Controller.cc.

Referenced by snmp_prfProtoFn(), snmp_sysFn(), and storeDigestCalcCap().

bool Store::Controller::dereferenceIdle ( StoreEntry e,
bool  wantsLocalMemory 
)
private
StoreEntry * Store::Controller::find ( const cache_key key)
private

Internal method to implements the guts of the Store::get() API: returns an in-transit or cached object with a given key, if any.

Definition at line 304 of file Controller.cc.

References assert, debugs, hash_lookup(), HERE(), NULL, store_table, and storeKeyText().

StoreEntry * Store::Controller::get ( const cache_key )
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 290 of file Controller.cc.

References NULL, and StoreEntry::touch().

Referenced by neighborsHtcpReply(), peerDigestRequest(), storeGetPublic(), and storeGetPublicByRequestMethod().

void Store::Controller::init ( )
overridevirtual

Start preparing the store for use. To check readiness, callers should use readable() and writable() methods.

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 58 of file Controller.cc.

References SquidConfig::collapsed_forwarding, Config, IamWorkerProcess(), MemStore::init(), Transients::init(), SquidConfig::memShared, SquidConfig::onoff, and UsingSmp().

Referenced by testRock::storeInit(), storeInit(), testStoreHashIndex::testSearch(), testStoreController::testSearch(), and testUfs::testUfsSearch().

void Store::Controller::maintain ( )
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 89 of file Controller.cc.

References DBG_CRITICAL, debugs, PROF_start, PROF_stop, Store::Root(), and squid_curtime.

Referenced by Store::Maintain().

void Store::Controller::markForUnlink ( StoreEntry e)
overridevirtual
int64_t Store::Controller::maxObjectSize ( ) const
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 181 of file Controller.cc.

Referenced by MemStore::init().

uint64_t Store::Controller::maxSize ( ) const
overridevirtual

The maximum size the store will support in normal use. Inaccuracy is permitted, but may throw estimates for memory etc out of whack.

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 153 of file Controller.cc.

Referenced by Store::Disks::init(), snmp_confFn(), storeDigestCalcCap(), and testStore::testMaxSize().

void Store::Controller::memoryDisconnect ( StoreEntry e)

Definition at line 417 of file Controller.cc.

Referenced by StoreEntry::destroyMemObject().

void Store::Controller::memoryOut ( StoreEntry e,
const bool  preserveSwappable 
)

Definition at line 393 of file Controller.cc.

References debugs, HERE(), and StoreEntry::trimMemory().

Referenced by StoreEntry::swapOut().

void Store::Controller::memoryUnlink ( StoreEntry e)

Definition at line 408 of file Controller.cc.

References StoreEntry::destroyMemObject().

Referenced by StoreEntry::purgeMem(), and StoreEntry::release().

uint64_t Store::Controller::minSize ( ) const
overridevirtual

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 160 of file Controller.cc.

StoreSearch * Store::Controller::search ( )
bool Store::Controller::smpAware ( ) const
overridevirtual

whether this storage is capable of serving multiple workers; a true result does not imply [lack of] non-SMP support because [only] some SMP-aware storages also support non-SMP configss

Implements Store::Storage.

Definition at line 609 of file Controller.cc.

Referenced by clientReplyContext::processExpired().

void Store::Controller::stat ( StoreEntry e) const
overridevirtual

Output stats to the provided store entry.

Todo:
make these calls asynchronous

Implements Store::Storage.

Reimplemented in TestStore.

Definition at line 131 of file Controller.cc.

References Math::doublePercent(), StoreEntry::inUseCount(), PRIu64, and storeAppendPrintf().

Referenced by Store::Stats().

void Store::Controller::sync ( void  )
overridevirtual

Reimplemented from Store::Storage.

Definition at line 212 of file Controller.cc.

Referenced by SquidShutdown().

int Store::Controller::transientReaders ( const StoreEntry e) const
void Store::Controller::transientsCompleteWriting ( StoreEntry e)
void Store::Controller::transientsDisconnect ( MemObject mem_obj)

Definition at line 452 of file Controller.cc.

Referenced by StoreEntry::destroyMemObject().

void Store::Controller::unlink ( StoreEntry e)
overridevirtual

Implements Store::Storage.

Definition at line 366 of file Controller.cc.

References StoreEntry::swap_filen.

Referenced by StoreEntry::release().

Member Data Documentation

Memory* Store::Controller::memStore
private

Definition at line 103 of file Controller.h.

Disks* Store::Controller::swapDir
private

Definition at line 102 of file Controller.h.

Transients* Store::Controller::transients
private

A shared table of public store entries that do not know whether they will belong to a memory cache, a disk cache, or will be uncachable when the response header comes. Used for SMP collapsed forwarding.

Definition at line 108 of file Controller.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors