summary view of all disk caches (cache_dirs) combined More...

#include <Disks.h>

Inheritance diagram for Store::Disks:
Collaboration diagram for Store::Disks:

Public Member Functions

 Disks ()
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
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 reference (StoreEntry &) override
 somebody needs this entry (many cache replacement policies need to know) More...
virtual bool dereference (StoreEntry &e) override
virtual void updateHeaders (StoreEntry *) override
 make stored metadata and HTTP headers the same as in the given entry More...
virtual void maintain () override
 perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain More...
virtual bool anchorToCache (StoreEntry &e, bool &inSync) override
virtual bool updateAnchored (StoreEntry &) override
virtual void evictCached (StoreEntry &) override
virtual void evictIfFound (const cache_key *) override
virtual int callback () override
 called once every main loop iteration; TODO: Move to UFS code. More...
void updateLimits ()
 slowly calculate (and cache) hi/lo watermarks and similar limits More...
int64_t accumulateMore (const StoreEntry &) const
bool hasReadableEntry (const StoreEntry &) const
 whether any of disk caches has entry with e.key More...

Static Public Member Functions

static bool SmpAware ()
 whether any disk cache is SMP-aware More...

Private Member Functions

SwapDirstore (int const x) const

Static Private Member Functions

static SwapDirDir (int const idx)

Private Attributes

int64_t largestMinimumObjectSize
 maximum of all Disk::minObjectSize()s More...
int64_t largestMaximumObjectSize
 maximum of all Disk::maxObjectSize()s More...
int64_t secondLargestMaximumObjectSize
 the second-biggest Disk::maxObjectSize() More...

Detailed Description

Definition at line 18 of file Disks.h.

Constructor & Destructor Documentation

◆ Disks()

Store::Disks::Disks ( )

Definition at line 151 of file

Member Function Documentation

◆ accumulateMore()

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

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

Definition at line 382 of file

References MemObject::availableForSwapOut(), debugs, largestMinimumObjectSize, StoreEntry::mem_obj, and secondLargestMaximumObjectSize.

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

◆ anchorToCache()

bool Store::Disks::anchorToCache ( StoreEntry ,
bool &   

If Transients entry cannot be attached to this storage, return false. If the entry is not found, return false. Otherwise, return true after tying the entry to this cache and setting inSync to updateAnchored().

Reimplemented from Store::Controlled.

Definition at line 515 of file

References Store::Disk::active(), Store::Controlled::anchorToCache(), SquidConfig::cacheSwap, Config, debugs, Dir(), and Store::DiskConfig::n_configured.

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

◆ callback()

int Store::Disks::callback ( )

◆ create()

void Store::Disks::create ( )

◆ currentCount()

uint64_t Store::Disks::currentCount ( ) const

◆ currentSize()

uint64_t Store::Disks::currentSize ( ) const

◆ dereference()

bool Store::Disks::dereference ( StoreEntry e)

somebody no longer needs this entry (usually after calling reference()) return false iff the idle entry should be destroyed

Implements Store::Controlled.

Definition at line 454 of file

References Store::Disk::dereference(), and StoreEntry::disk().

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

◆ Dir()

SwapDir & Store::Disks::Dir ( int const  idx)

◆ evictCached()

void Store::Disks::evictCached ( StoreEntry e)

Prevent new get() calls from returning the matching entry. If the matching entry is unused, it may be removed from the store now. The store entry is matched using either e attachment info or e.key.

Implements Store::Storage.

Definition at line 489 of file

References StoreEntry::disk(), EBIT_TEST, Store::Storage::evictCached(), evictIfFound(), StoreEntry::flags, StoreEntry::hasDisk(), KEY_PRIVATE, StoreEntry::publicKey(), storeDirSwapLog(), and SWAP_LOG_DEL.

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

◆ evictIfFound()

void Store::Disks::evictIfFound ( const cache_key )

An evictCached() equivalent for callers that did not get() a StoreEntry. Callers with StoreEntry objects must use evictCached() instead.

Implements Store::Storage.

Definition at line 506 of file

References SquidConfig::cacheSwap, Config, Dir(), Store::Storage::evictIfFound(), i, and Store::DiskConfig::n_configured.

Referenced by evictCached(), and Store::Controller::evictIfFound().

◆ get()

StoreEntry * Store::Disks::get ( const cache_key )
a possibly unlocked/unregistered stored entry with key (or nil) The returned entry might not match the caller's Store ID or method. The caller must abandon()/release() the entry or register it with Root(). This method must not trigger slow I/O operations (e.g., disk swap in).

Implements Store::Controlled.

Definition at line 218 of file

References Store::Disk::active(), SquidConfig::cacheSwap, Config, debugs, Store::Disk::get(), INDEXSD, Store::DiskConfig::n_configured, and storeKeyText().

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

◆ getStats()

void Store::Disks::getStats ( StoreInfoStats stats) const

◆ hasReadableEntry()

bool Store::Disks::hasReadableEntry ( const StoreEntry e) const

◆ init()

◆ maintain()

void Store::Disks::maintain ( )

◆ maxObjectSize()

int64_t Store::Disks::maxObjectSize ( ) const

Implements Store::Storage.

Definition at line 352 of file

References largestMaximumObjectSize.

Referenced by Store::Controller::maxObjectSize(), and Store::Controller::updateLimits().

◆ maxSize()

uint64_t Store::Disks::maxSize ( ) const

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.

Definition at line 300 of file

References SquidConfig::cacheSwap, Config, Dir(), i, Store::Disk::maxSize(), Store::DiskConfig::n_configured, and store().

Referenced by init(), and Store::Controller::maxSize().

◆ minSize()

uint64_t Store::Disks::minSize ( ) const

◆ reference()

void Store::Disks::reference ( StoreEntry e)

Implements Store::Controlled.

Definition at line 448 of file

References StoreEntry::disk(), and Store::Disk::reference().

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

◆ SmpAware()

bool Store::Disks::SmpAware ( )

Definition at line 548 of file

References SquidConfig::cacheSwap, Config, Dir(), i, and Store::DiskConfig::n_configured.

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

◆ stat()

void Store::Disks::stat ( StoreEntry e) const

Output stats to the provided store entry.

make these calls asynchronous

Implements Store::Storage.

Definition at line 435 of file

References SquidConfig::cacheSwap, Config, i, Store::DiskConfig::n_configured, Store::Disk::stat(), store(), and storeAppendPrintf().

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

◆ store()

SwapDir * Store::Disks::store ( int const  x) const

Definition at line 159 of file

References INDEXSD.

Referenced by callback(), create(), currentCount(), currentSize(), getStats(), init(), maintain(), maxSize(), minSize(), stat(), and sync().

◆ sync()

void Store::Disks::sync ( void  )

Reimplemented from Store::Storage.

Definition at line 482 of file

References SquidConfig::cacheSwap, Config, i, Store::DiskConfig::n_configured, store(), and Store::Storage::sync().

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

◆ updateAnchored()

bool Store::Disks::updateAnchored ( StoreEntry )

Update a local Transients entry with fresh info from this cache (if any). Return true iff the cache supports Transients entries and the given local Transients entry is now in sync with this storage.

Reimplemented from Store::Controlled.

Definition at line 541 of file

References Dir(), StoreEntry::hasDisk(), StoreEntry::swap_dirn, and Store::Controlled::updateAnchored().

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

◆ updateHeaders()

void Store::Disks::updateHeaders ( StoreEntry )

Reimplemented from Store::Controlled.

Definition at line 460 of file

References StoreEntry::disk(), Must, and Store::Controlled::updateHeaders().

◆ updateLimits()

Member Data Documentation

◆ largestMaximumObjectSize

int64_t Store::Disks::largestMaximumObjectSize

Definition at line 62 of file Disks.h.

Referenced by maxObjectSize(), and updateLimits().

◆ largestMinimumObjectSize

int64_t Store::Disks::largestMinimumObjectSize

Definition at line 61 of file Disks.h.

Referenced by accumulateMore(), and updateLimits().

◆ secondLargestMaximumObjectSize

int64_t Store::Disks::secondLargestMaximumObjectSize

Definition at line 63 of file Disks.h.

Referenced by accumulateMore(), and updateLimits().

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






Web Site Translations