manages a single cache_dir More...

#include <Disk.h>

Inheritance diagram for Store::Disk:
Collaboration diagram for Store::Disk:

Classes

class  CleanLog
 
struct  Flags
 

Public Types

typedef RefCount< DiskPointer
 

Public Member Functions

 Disk (char const *aType)
 
virtual ~Disk ()
 
virtual void reconfigure ()=0
 
char const * type () const
 
virtual bool needsDiskStrand () const
 needs a dedicated kid process More...
 
virtual bool active () const
 
virtual bool doReportStat () const
 whether stat should be reported by this SwapDir More...
 
virtual bool unlinkdUseful () const =0
 whether SwapDir may benefit from unlinkd More...
 
virtual void diskFull ()
 
virtual void create () override
 create system resources needed for this store to operate in the future More...
 
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 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 reference (StoreEntry &e) override
 somebody needs this entry (many cache replacement policies need to know) More...
 
virtual bool dereference (StoreEntry &e) override
 
virtual void maintain () override
 perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain More...
 
virtual bool smpAware () const override
 
int64_t minObjectSize () const
 the size of the smallest entry this cache_dir can store More...
 
void maxObjectSize (int64_t newMax)
 
bool objectSizeIsAcceptable (int64_t objSize) const
 
virtual void disconnect (StoreEntry &)
 called when the entry is about to forget its association with cache_dir More...
 
virtual void swappedOut (const StoreEntry &e)=0
 called when entry swap out is complete More...
 
virtual void dump (StoreEntry &) const
 
virtual bool doubleCheck (StoreEntry &)
 
virtual void statfs (StoreEntry &) const
 
virtual bool canStore (const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const =0
 check whether we can store the entry; if we can, report current load More...
 
virtual StoreIOState::Pointer createStoreIO (StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *)=0
 
virtual StoreIOState::Pointer openStoreIO (StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *)=0
 
bool canLog (StoreEntry const &e) const
 
virtual void openLog ()
 
virtual void closeLog ()
 
virtual void logEntry (const StoreEntry &e, int op) const
 
virtual int writeCleanStart ()
 
virtual void writeCleanDone ()
 
virtual void parse (int index, char *path)=0
 
virtual void updateHeaders (StoreEntry *)
 make stored metadata and HTTP headers the same as in the given entry More...
 
virtual bool anchorCollapsed (StoreEntry &, bool &)
 
virtual bool updateCollapsed (StoreEntry &)
 
virtual void init ()=0
 
virtual uint64_t currentSize () const =0
 current size More...
 
virtual uint64_t currentCount () const =0
 the total number of objects stored right now More...
 
virtual void markForUnlink (StoreEntry &e)=0
 expect an unlink() call after the entry becomes idle More...
 
virtual void unlink (StoreEntry &e)=0
 remove the entry from the store More...
 
virtual int callback ()
 called once every main loop iteration; TODO: Move to UFS code. More...
 
virtual void sync ()
 prepare for shutdown More...
 

Public Attributes

char * path
 
int index
 
int disker
 disker kid id dedicated to this SwapDir or -1 More...
 
RemovalPolicyrepl
 
int removals
 
int scanned
 
struct Store::Disk::Flags flags
 
CleanLogcleanLog
 
struct {
   int   blksize
 
fs
 

Protected Member Functions

void parseOptions (int reconfiguring)
 
void dumpOptions (StoreEntry *e) const
 
virtual ConfigOptiongetOptionTree () const
 
virtual bool allowOptionReconfigure (const char *const) const
 
int64_t sizeInBlocks (const int64_t size) const
 

Protected Attributes

uint64_t max_size
 maximum allocatable size of the storage area More...
 
int64_t min_objsize
 minimum size of any object stored here (-1 for no limit) More...
 
int64_t max_objsize
 maximum size of any object stored here (-1 for no limit) More...
 

Private Member Functions

bool optionReadOnlyParse (char const *option, const char *value, int reconfiguring)
 
void optionReadOnlyDump (StoreEntry *e) const
 
bool optionObjectSizeParse (char const *option, const char *value, int reconfiguring)
 
void optionObjectSizeDump (StoreEntry *e) const
 

Private Attributes

char const * theType
 

Detailed Description

Definition at line 21 of file Disk.h.

Member Typedef Documentation

Definition at line 25 of file Disk.h.

Constructor & Destructor Documentation

Store::Disk::Disk ( char const *  aType)
explicit

Definition at line 24 of file Disk.cc.

References fs.

Store::Disk::~Disk ( )
virtual

Definition at line 33 of file Disk.cc.

References xfree.

Member Function Documentation

bool Store::Disk::active ( ) const
virtual

may be used in this strand

Definition at line 236 of file Disk.cc.

References IamWorkerProcess(), and KidIdentifier.

Referenced by Store::Disks::anchorCollapsed(), and Store::Disks::get().

virtual bool Store::Disk::allowOptionReconfigure ( const char *  const) const
inlineprotectedvirtual

Reimplemented in Rock::SwapDir.

Definition at line 79 of file Disk.h.

Referenced by Rock::SwapDir::allowOptionReconfigure().

virtual bool Store::Controlled::anchorCollapsed ( StoreEntry ,
bool &   
)
inlinevirtualinherited

If this storage cannot cache collapsed entries, return false. If the entry is not found, return false. Otherwise, return true after tying the entry to this cache and setting inSync to updateCollapsed().

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 34 of file Controlled.h.

Referenced by Store::Disks::anchorCollapsed().

virtual int Store::Storage::callback ( )
inlinevirtualinherited

Reimplemented in Fs::Ufs::UFSSwapDir, TestStore, Store::Controller, and Store::Disks.

Definition at line 70 of file Storage.h.

bool Store::Disk::canLog ( StoreEntry const &  e) const
bool Store::Disk::canStore ( const StoreEntry e,
int64_t  diskSpaceNeeded,
int load 
) const
pure virtual
void Store::Disk::closeLog ( )
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 215 of file Disk.cc.

void Store::Disk::create ( )
overridevirtual

Implements Store::Storage.

Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.

Definition at line 40 of file Disk.cc.

virtual StoreIOState::Pointer Store::Disk::createStoreIO ( StoreEntry ,
StoreIOState::STFNCB ,
StoreIOState::STIOCB ,
void *   
)
pure virtual

Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.

Referenced by storeCreate().

virtual uint64_t Store::Storage::currentCount ( ) const
pure virtualinherited
virtual uint64_t Store::Storage::currentSize ( ) const
pure virtualinherited
bool Store::Disk::dereference ( StoreEntry e)
overridevirtual

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

Implements Store::Controlled.

Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.

Definition at line 139 of file Disk.cc.

Referenced by Store::Disks::dereference().

virtual void Store::Disk::disconnect ( StoreEntry )
inlinevirtual

Reimplemented in Rock::SwapDir.

Definition at line 70 of file Disk.h.

Referenced by destroyStoreEntry().

void Store::Disk::diskFull ( )
virtual

Notify this disk that it is full.

Todo:
XXX move into a protected api call between store files and their stores, rather than a top level api call

Reimplemented in Rock::SwapDir.

Definition at line 145 of file Disk.cc.

References DBG_IMPORTANT, and debugs.

Referenced by storeSwapOutFileClosed().

virtual bool Store::Disk::doReportStat ( ) const
inlinevirtual

Reimplemented in Rock::SwapDir.

Definition at line 35 of file Disk.h.

bool Store::Disk::doubleCheck ( StoreEntry )
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 46 of file Disk.cc.

Referenced by storeCleanupDoubleCheck().

void Store::Disk::dump ( StoreEntry ) const
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 43 of file Disk.cc.

Referenced by dump_cachedir().

void Store::Disk::dumpOptions ( StoreEntry e) const
protected

Definition at line 307 of file Disk.cc.

References ConfigOption::dump().

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

Implements Store::Storage.

Reimplemented in Rock::SwapDir.

Definition at line 393 of file Disk.cc.

References NULL.

Referenced by Store::Disks::get().

ConfigOption * Store::Disk::getOptionTree ( ) const
protectedvirtual
void Store::Disk::getStats ( StoreInfoStats stats) const
overridevirtual
virtual void Store::Storage::init ( )
pure virtualinherited

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

Implemented in Rock::SwapDir, Transients, TestStore, MemStore, Fs::Ufs::UFSSwapDir, Store::Controller, TestSwapDir, and Store::Disks.

void Store::Disk::logEntry ( const StoreEntry e,
int  op 
) const
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 227 of file Disk.cc.

void Store::Disk::maintain ( )
overridevirtual

Implements Store::Storage.

Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.

Definition at line 86 of file Disk.cc.

virtual void Store::Storage::markForUnlink ( StoreEntry e)
pure virtualinherited
int64_t Store::Disk::maxObjectSize ( ) const
overridevirtual
void Store::Disk::maxObjectSize ( int64_t  newMax)

configure the maximum object size for this storage area. May be any size up to the total storage area.

Definition at line 115 of file Disk.cc.

References DBG_PARSE_NOTE, and debugs.

virtual uint64_t Store::Disk::maxSize ( ) const
inlineoverridevirtual

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 TestSwapDir.

Definition at line 48 of file Disk.h.

References max_size.

Referenced by storeDirSelectSwapDirLeastLoad().

int64_t Store::Disk::minObjectSize ( ) const

Definition at line 96 of file Disk.cc.

References Config, SquidConfig::minObjectSize, and SquidConfig::Store.

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

Implements Store::Storage.

Definition at line 89 of file Disk.cc.

References Config, SquidConfig::lowWaterMark, and SquidConfig::Swap.

bool Store::Disk::needsDiskStrand ( ) const
virtual

Reimplemented in Rock::SwapDir.

Definition at line 249 of file Disk.cc.

Referenced by configDoConfigure().

bool Store::Disk::objectSizeIsAcceptable ( int64_t  objSize) const

whether we can store an object of the given size negative objSize means the object size is currently unknown

Definition at line 156 of file Disk.cc.

References assert.

void Store::Disk::openLog ( )
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 212 of file Disk.cc.

virtual StoreIOState::Pointer Store::Disk::openStoreIO ( StoreEntry ,
StoreIOState::STFNCB ,
StoreIOState::STIOCB ,
void *   
)
pure virtual

Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.

Referenced by storeOpen().

void Store::Disk::optionObjectSizeDump ( StoreEntry e) const
private

Definition at line 382 of file Disk.cc.

References PRId64, and storeAppendPrintf().

Referenced by getOptionTree().

bool Store::Disk::optionObjectSizeParse ( char const *  option,
const char *  value,
int  reconfiguring 
)
private

Definition at line 347 of file Disk.cc.

References DBG_IMPORTANT, debugs, NULL, self_destruct(), size, and strtoll().

Referenced by getOptionTree().

void Store::Disk::optionReadOnlyDump ( StoreEntry e) const
private

Definition at line 340 of file Disk.cc.

References storeAppendPrintf().

Referenced by getOptionTree().

bool Store::Disk::optionReadOnlyParse ( char const *  option,
const char *  value,
int  reconfiguring 
)
private

Definition at line 318 of file Disk.cc.

References DBG_PARSE_NOTE, debugs, and xatoi().

Referenced by getOptionTree().

virtual void Store::Disk::parse ( int  index,
char *  path 
)
pure virtual

Implemented in Fs::Ufs::UFSSwapDir, Rock::SwapDir, and TestSwapDir.

Referenced by parse_cachedir().

void Store::Disk::parseOptions ( int  reconfiguring)
protected
virtual void Store::Disk::reconfigure ( )
pure virtual

Implemented in Fs::Ufs::UFSSwapDir, Rock::SwapDir, and TestSwapDir.

Referenced by parse_cachedir().

void Store::Disk::reference ( StoreEntry e)
overridevirtual

Implements Store::Controlled.

Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.

Definition at line 136 of file Disk.cc.

Referenced by Store::Disks::reference().

int64_t Store::Disk::sizeInBlocks ( const int64_t  size) const
inlineprotected

Definition at line 81 of file Disk.h.

References fs.

virtual bool Store::Disk::smpAware ( ) const
inlineoverridevirtual

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.

Reimplemented in Fs::Ufs::UFSSwapDir, and Rock::SwapDir.

Definition at line 56 of file Disk.h.

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

Output stats to the provided store entry.

Todo:
make these calls asynchronous

Implements Store::Storage.

Reimplemented in TestSwapDir.

Definition at line 63 of file Disk.cc.

References storeAppendPrintf(), and type.

void Store::Disk::statfs ( StoreEntry ) const
virtual

Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.

Definition at line 83 of file Disk.cc.

virtual void Store::Disk::swappedOut ( const StoreEntry e)
pure virtual
virtual void Store::Storage::sync ( void  )
inlinevirtualinherited

Reimplemented in Fs::Ufs::UFSSwapDir, Store::Controller, and Store::Disks.

Definition at line 76 of file Storage.h.

char const * Store::Disk::type ( ) const

Definition at line 230 of file Disk.cc.

Referenced by dump_cachedir(), and parse_cachedir().

virtual void Store::Storage::unlink ( StoreEntry e)
pure virtualinherited
virtual bool Store::Disk::unlinkdUseful ( ) const
pure virtual

Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.

Referenced by unlinkdNeeded().

virtual bool Store::Controlled::updateCollapsed ( StoreEntry )
inlinevirtualinherited

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

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 39 of file Controlled.h.

virtual void Store::Controlled::updateHeaders ( StoreEntry )
inlinevirtualinherited

Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.

Definition at line 29 of file Controlled.h.

Referenced by Store::Disks::updateHeaders().

void Store::Disk::writeCleanDone ( )
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 224 of file Disk.cc.

int Store::Disk::writeCleanStart ( )
virtual

Reimplemented in Fs::Ufs::UFSSwapDir.

Definition at line 218 of file Disk.cc.

Referenced by storeDirWriteCleanLogs().

Member Data Documentation

int Store::Disk::blksize

Definition at line 140 of file Disk.h.

CleanLog* Store::Disk::cleanLog

Definition at line 134 of file Disk.h.

Referenced by storeDirWriteCleanLogs(), and UFSCleanLog::write().

int Store::Disk::disker

Definition at line 98 of file Disk.h.

Referenced by configDoConfigure().

struct Store::Disk::Flags Store::Disk::flags
struct { ... } Store::Disk::fs

Referenced by Disk(), and sizeInBlocks().

int Store::Disk::index

Definition at line 97 of file Disk.h.

Referenced by storeDirWriteCleanLogs(), and Fs::Ufs::UFSStoreState::UFSStoreState().

int64_t Store::Disk::max_objsize
protected

Definition at line 93 of file Disk.h.

uint64_t Store::Disk::max_size
protected

Definition at line 91 of file Disk.h.

Referenced by maxSize().

int64_t Store::Disk::min_objsize
protected

Definition at line 92 of file Disk.h.

char* Store::Disk::path

Definition at line 96 of file Disk.h.

Referenced by Fs::Ufs::UFSSwapDir::DirClean(), dump_cachedir(), and parse_cachedir().

int Store::Disk::removals

Definition at line 100 of file Disk.h.

RemovalPolicy* Store::Disk::repl

Definition at line 99 of file Disk.h.

int Store::Disk::scanned

Definition at line 101 of file Disk.h.

char const* Store::Disk::theType
private

Definition at line 88 of file Disk.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors