|
Squid Web Cache master
|
manages a single cache_dir More...
#include <Disk.h>
Classes | |
| class | CleanLog |
| struct | Flags |
Public Types | |
| typedef RefCount< Disk > | Pointer |
Public Member Functions | |
| Disk (char const *aType) | |
| ~Disk () override | |
| virtual void | reconfigure ()=0 |
| char const * | type () const |
| virtual bool | needsDiskStrand () const |
| needs a dedicated kid process | |
| virtual bool | active () const |
| virtual bool | doReportStat () const |
| whether stat should be reported by this SwapDir | |
| virtual bool | unlinkdUseful () const =0 |
| whether SwapDir may benefit from unlinkd | |
| virtual void | diskFull () |
| void | create () override |
| create system resources needed for this store to operate in the future | |
| StoreEntry * | get (const cache_key *) override |
| uint64_t | maxSize () const override |
| uint64_t | minSize () const override |
| the minimum size the store will shrink to via normal housekeeping | |
| int64_t | maxObjectSize () const override |
| the maximum size of a storable object; -1 if unlimited | |
| void | getStats (StoreInfoStats &stats) const override |
| collect statistics | |
| void | stat (StoreEntry &) const override |
| void | reference (StoreEntry &e) override |
| somebody needs this entry (many cache replacement policies need to know) | |
| bool | dereference (StoreEntry &e) override |
| void | maintain () override |
| perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain | |
| virtual bool | smpAware () const =0 |
| whether this disk storage is capable of serving multiple workers | |
| int64_t | minObjectSize () const |
| the size of the smallest entry this cache_dir can store | |
| 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 | |
| virtual void | finalizeSwapoutSuccess (const StoreEntry &)=0 |
| finalize the successful swapout that has been already noticed by Store | |
| virtual void | finalizeSwapoutFailure (StoreEntry &)=0 |
| abort the failed swapout that has been already noticed by Store | |
| virtual bool | hasReadableEntry (const StoreEntry &e) const =0 |
whether this cache dir has an entry with e.key | |
| 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 | |
| virtual StoreIOState::Pointer | createStoreIO (StoreEntry &, StoreIOState::STIOCB *, void *)=0 |
| virtual StoreIOState::Pointer | openStoreIO (StoreEntry &, 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 | |
| virtual bool | anchorToCache (StoreEntry &) |
| virtual bool | updateAnchored (StoreEntry &) |
| virtual void | init ()=0 |
| virtual uint64_t | currentSize () const =0 |
| current size | |
| virtual uint64_t | currentCount () const =0 |
| the total number of objects stored right now | |
| virtual void | evictCached (StoreEntry &e)=0 |
| virtual void | evictIfFound (const cache_key *)=0 |
| virtual int | callback () |
| called once every main loop iteration; TODO: Move to UFS code. | |
| virtual void | sync () |
| prepare for shutdown | |
Public Attributes | ||
| char * | path | |
| int | index | |
| int | disker | |
| disker kid id dedicated to this SwapDir or -1 | ||
| RemovalPolicy * | repl | |
| int | removals | |
| int | scanned | |
| struct Store::Disk::Flags | flags | |
| CleanLog * | cleanLog | |
| struct { | ||
| int blksize | ||
| } | fs | |
Protected Member Functions | |
| void | parseOptions (int reconfiguring) |
| void | dumpOptions (StoreEntry *e) const |
| virtual ConfigOption * | getOptionTree () 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 | |
| int64_t | min_objsize |
| minimum size of any object stored here (-1 for no limit) | |
| int64_t | max_objsize |
| maximum size of any object stored here (-1 for no limit) | |
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 |
| typedef RefCount<Disk> Store::Disk::Pointer |
|
explicit |
|
virtual |
may be used in this strand
Definition at line 236 of file Disk.cc.
References IamWorkerProcess(), and KidIdentifier.
Referenced by Store::Disks::anchorToCache(), and doReportStat().
|
inlineprotectedvirtual |
Reimplemented in Rock::SwapDir.
Definition at line 85 of file Disk.h.
Referenced by Rock::SwapDir::allowOptionReconfigure().
|
inlinevirtualinherited |
tie StoreEntry to this storage if this storage has a matching entry
| true | if this storage has a matching entry |
Reimplemented in Rock::SwapDir, MemStore, and Store::Disks.
Definition at line 39 of file Controlled.h.
Referenced by Store::Disks::anchorToCache().
|
inlinevirtualinherited |
Reimplemented in Fs::Ufs::UFSSwapDir, Store::Controller, and Store::Disks.
| bool Store::Disk::canLog | ( | StoreEntry const & | e | ) | const |
Definition at line 188 of file Disk.cc.
References EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, StoreEntry::hasDisk(), KEY_PRIVATE, RELEASE_REQUEST, StoreEntry::swap_file_sz, and StoreEntry::swappedOut().
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
Definition at line 164 of file Disk.cc.
References debugs, EBIT_TEST, ENTRY_SPECIAL, and StoreEntry::flags.
Referenced by Rock::SwapDir::canStore(), and Fs::Ufs::UFSSwapDir::canStore().
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
Definition at line 215 of file Disk.cc.
Referenced by storeDirCloseSwapLogs().
|
overridevirtual |
Implements Store::Storage.
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
pure virtualinherited |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, MemStore, Store::Controller, Store::Disks, TestSwapDir, and Transients.
|
pure virtualinherited |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, MemStore, Store::Controller, Store::Disks, TestSwapDir, and Transients.
|
overridevirtual |
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 139 of file Disk.cc.
Referenced by Store::Disks::dereference().
|
inlinevirtual |
Reimplemented in Rock::SwapDir.
Definition at line 71 of file Disk.h.
Referenced by storeGetPublic().
|
virtual |
Notify this disk that it is full. 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().
|
inlinevirtual |
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
Definition at line 46 of file Disk.cc.
Referenced by storeCleanup().
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
|
protected |
Definition at line 307 of file Disk.cc.
References ConfigOption::dump().
|
pure virtualinherited |
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.
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, MemStore, Store::Controller, Store::Disks, TestSwapDir, and Transients.
Referenced by Store::Disks::evictCached().
|
pure virtualinherited |
An evictCached() equivalent for callers that did not get() a StoreEntry. Callers with StoreEntry objects must use evictCached() instead.
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, MemStore, Store::Controller, Store::Disks, TestSwapDir, and Transients.
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
Referenced by storeSwapOutFileClosed().
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
Referenced by storeSwapOutFileClosed().
|
overridevirtual |
Implements Store::Controlled.
|
protectedvirtual |
Reimplemented in Rock::SwapDir, and Fs::Ufs::UFSSwapDir.
Definition at line 258 of file Disk.cc.
References optionObjectSizeDump(), optionObjectSizeParse(), optionReadOnlyDump(), optionReadOnlyParse(), and ConfigOptionVector::options.
Referenced by Rock::SwapDir::getOptionTree(), and Fs::Ufs::UFSSwapDir::getOptionTree().
|
overridevirtual |
Implements Store::Storage.
Definition at line 52 of file Disk.cc.
References StoreInfoStats::Part::capacity, StoreInfoStats::Part::count, StoreInfoStats::Part::size, and StoreInfoStats::swap.
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
pure virtualinherited |
Start preparing the store for use. To check readiness, callers should use readable() and writable() methods.
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, MemStore, Store::Controller, Store::Disks, TestSwapDir, and Transients.
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
Definition at line 227 of file Disk.cc.
Referenced by storeDirSwapLog().
|
overridevirtual |
Implements Store::Storage.
|
overridevirtual |
Implements Store::Storage.
Definition at line 103 of file Disk.cc.
References Config, SquidConfig::maxObjectSize, min(), and SquidConfig::Store.
Referenced by Fs::Ufs::UFSStoreState::write().
| 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.
|
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.
| int64_t Store::Disk::minObjectSize | ( | ) | const |
Definition at line 96 of file Disk.cc.
References Config, SquidConfig::minObjectSize, and SquidConfig::Store.
|
overridevirtual |
Implements Store::Storage.
Definition at line 89 of file Disk.cc.
References Config, SquidConfig::lowWaterMark, and SquidConfig::Swap.
|
virtual |
Reimplemented in Rock::SwapDir.
| bool Store::Disk::objectSizeIsAcceptable | ( | int64_t | objSize | ) | const |
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
Definition at line 212 of file Disk.cc.
Referenced by storeDirOpenSwapLogs().
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
Referenced by storeOpen().
|
private |
Definition at line 382 of file Disk.cc.
References PRId64, and storeAppendPrintf().
Referenced by getOptionTree().
|
private |
Definition at line 347 of file Disk.cc.
References DBG_IMPORTANT, debugs, self_destruct(), size, and strtoll().
Referenced by getOptionTree().
|
private |
Definition at line 340 of file Disk.cc.
References storeAppendPrintf().
Referenced by getOptionTree().
|
private |
Definition at line 318 of file Disk.cc.
References DBG_PARSE_NOTE, debugs, and xatoi().
Referenced by getOptionTree().
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
protected |
Definition at line 267 of file Disk.cc.
References DBG_IMPORTANT, debugs, ConfigParser::NextToken(), ConfigOption::parse(), and self_destruct().
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
overridevirtual |
Implements Store::Controlled.
Definition at line 136 of file Disk.cc.
Referenced by Store::Disks::reference().
|
inlineprotected |
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
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().
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir, and Rock::SwapDir.
|
inlinevirtualinherited |
Reimplemented in Fs::Ufs::UFSSwapDir, Store::Controller, and Store::Disks.
|
pure virtual |
Implemented in Rock::SwapDir, Fs::Ufs::UFSSwapDir, and TestSwapDir.
|
inlinevirtualinherited |
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 in Rock::SwapDir, MemStore, and Store::Disks.
Definition at line 44 of file Controlled.h.
Referenced by Store::Disks::updateAnchored().
|
inlinevirtualinherited |
Reimplemented in Store::Disks, Rock::SwapDir, and MemStore.
Definition at line 35 of file Controlled.h.
Referenced by Store::Disks::updateHeaders().
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
Definition at line 224 of file Disk.cc.
Referenced by storeDirWriteCleanLogs().
|
virtual |
Reimplemented in Fs::Ufs::UFSSwapDir.
| CleanLog* Store::Disk::cleanLog |
Definition at line 140 of file Disk.h.
Referenced by UFSCleanLog::write().
| struct Store::Disk::Flags Store::Disk::flags |
Referenced by storeDirSelectSwapDirLeastLoad().
| struct { ... } Store::Disk::fs |
Referenced by Disk(), and sizeInBlocks().
| int Store::Disk::index |
Definition at line 103 of file Disk.h.
Referenced by Fs::Ufs::UFSStoreState::UFSStoreState(), and Rock::Rebuild::Start().
|
protected |
| char* Store::Disk::path |
Definition at line 102 of file Disk.h.
Referenced by Fs::Ufs::UFSSwapDir::DirClean(), Rock::Rebuild::Stats::Init(), and Rock::Rebuild::Start().
| RemovalPolicy* Store::Disk::repl |