|
Squid Web Cache master
|
#include <Transients.h>
Classes | |
| class | EntryStatus |
| shared entry metadata, used for synchronization More... | |
Public Member Functions | |
| Transients () | |
| ~Transients () override | |
| StoreEntry * | findCollapsed (const sfileno xitIndex) |
| return a local, previously collapsed entry | |
| void | monitorIo (StoreEntry *, const cache_key *, const Store::IoStatus) |
| void | completeWriting (const StoreEntry &e) |
| called when the in-transit entry has been successfully cached | |
| void | status (const StoreEntry &e, EntryStatus &entryStatus) const |
| copies current shared entry metadata into entryStatus | |
| int | readers (const StoreEntry &e) const |
| number of entry readers some time ago | |
| void | disconnect (StoreEntry &) |
| the caller is done writing or reading the given entry | |
| StoreEntry * | get (const cache_key *) override |
| void | create () override |
| create system resources needed for this store to operate in the future | |
| void | init () override |
| uint64_t | maxSize () const override |
| uint64_t | minSize () const override |
| the minimum size the store will shrink to via normal housekeeping | |
| uint64_t | currentSize () const override |
| current size | |
| uint64_t | currentCount () const override |
| the total number of objects stored right now | |
| 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 &e) const override |
| void | reference (StoreEntry &e) override |
| somebody needs this entry (many cache replacement policies need to know) | |
| bool | dereference (StoreEntry &e) override |
| void | evictCached (StoreEntry &) override |
| void | evictIfFound (const cache_key *) override |
| void | maintain () override |
| perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain | |
| bool | markedForDeletion (const cache_key *) const |
| bool | isReader (const StoreEntry &) const |
| whether the entry is in "reading from Transients" I/O state | |
| bool | isWriter (const StoreEntry &) const |
| whether the entry is in "writing to Transients" I/O state | |
| bool | hasWriter (const StoreEntry &) |
| whether we or somebody else is in the "writing to Transients" I/O state | |
| 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 int | callback () |
| called once every main loop iteration; TODO: Move to UFS code. | |
| virtual void | sync () |
| prepare for shutdown | |
Static Public Member Functions | |
| static int64_t | EntryLimit () |
| calculates maximum number of entries we need to store and map | |
| static bool | Enabled () |
| Can we create and initialize Transients? | |
Protected Member Functions | |
| void | addEntry (StoreEntry *, const cache_key *, const Store::IoStatus) |
| creates a new Transients entry | |
| void | addWriterEntry (StoreEntry &, const cache_key *) |
| addEntry() helper used for cache entry creators/writers | |
| void | addReaderEntry (StoreEntry &, const cache_key *) |
| void | noteFreeMapSlice (const Ipc::StoreMapSliceId sliceId) override |
| adjust slice-linked state before a locked Readable slice is erased | |
Private Types | |
| typedef std::vector< StoreEntry * > | Locals |
Private Attributes | |
| TransientsMap * | map |
| shared packed info indexed by Store keys, for creating new StoreEntries | |
| Locals * | locals |
A Transients entry allows workers to Broadcast() DELETE requests and swapout progress updates. In a collapsed forwarding context, it also represents a CF initiating worker promise to either cache the response or inform the waiting slaves (via false EntryStatus::hasWriter) that caching will not happen. A Transients entry itself does not carry response- or Store-specific metadata.
Definition at line 27 of file Transients.h.
|
private |
Definition at line 105 of file Transients.h.
| Transients::Transients | ( | ) |
Definition at line 35 of file Transients.cc.
|
override |
Definition at line 39 of file Transients.cc.
|
protected |
Definition at line 216 of file Transients.cc.
References addReaderEntry(), addWriterEntry(), assert, StoreEntry::hasTransients(), Store::ioReading, Store::ioWriting, map, StoreEntry::mem_obj, and Must.
Referenced by monitorIo().
|
protected |
addEntry() helper used for cache readers readers do not modify the cache, but they must create a Transients entry
Definition at line 253 of file Transients.cc.
References Here, Store::ioReading, map, StoreEntry::mem_obj, MemObject::XitTable::open(), Ipc::StoreMap::openOrCreateForReading(), and MemObject::xitTable.
Referenced by addEntry().
|
protected |
Definition at line 233 of file Transients.cc.
References Here, Store::ioWriting, map, StoreEntry::mem_obj, MemObject::XitTable::open(), Ipc::StoreMap::openForWriting(), Ipc::StoreMap::startAppending(), and MemObject::xitTable.
Referenced by addEntry().
|
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.
| void Transients::completeWriting | ( | const StoreEntry & | e | ) |
Definition at line 291 of file Transients.cc.
References assert, CollapsedForwarding::Broadcast(), debugs, StoreEntry::hasTransients(), MemObject::XitTable::index, MemObject::XitTable::io, Store::ioReading, isWriter(), map, StoreEntry::mem_obj, Ipc::StoreMap::switchWritingToReading(), and MemObject::xitTable.
|
inlineoverridevirtual |
Implements Store::Storage.
Definition at line 62 of file Transients.h.
|
overridevirtual |
Implements Store::Storage.
Definition at line 125 of file Transients.cc.
References Ipc::StoreMap::entryCount(), and map.
Referenced by getStats(), and stat().
|
overridevirtual |
|
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 144 of file Transients.cc.
| void Transients::disconnect | ( | StoreEntry & | entry | ) |
Definition at line 337 of file Transients.cc.
References assert, CollapsedForwarding::Broadcast(), Ipc::StoreMap::closeForReadingAndFreeIdle(), Ipc::StoreMap::closeForWriting(), debugs, StoreEntry::hasTransients(), isReader(), isWriter(), locals, map, StoreEntry::mem_obj, and MemObject::xitTable.
|
inlinestatic |
Definition at line 91 of file Transients.h.
References EntryLimit().
Referenced by Store::Controller::init(), and init().
|
static |
Definition at line 361 of file Transients.cc.
References Config, SquidConfig::shared_transient_entries_limit, Store::Controller::SmpAware(), and UsingSmp().
Referenced by TransientsRr::create(), Enabled(), and init().
|
overridevirtual |
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 312 of file Transients.cc.
References CollapsedForwarding::Broadcast(), debugs, Ipc::StoreMap::freeEntry(), StoreEntry::hasTransients(), MemObject::XitTable::index, map, StoreEntry::mem_obj, and MemObject::xitTable.
|
overridevirtual |
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 326 of file Transients.cc.
References CollapsedForwarding::Broadcast(), Ipc::StoreMap::fileNoByKey(), Ipc::StoreMap::freeEntry(), and map.
| StoreEntry * Transients::findCollapsed | ( | const sfileno | xitIndex | ) |
|
overridevirtual |
Implements Store::Controlled.
Definition at line 151 of file Transients.cc.
References assert, Ipc::StoreMap::closeForReadingAndFreeIdle(), StoreEntry::createMemObject(), debugs, EBIT_TEST, Store::ioReading, KEY_PRIVATE, locals, map, StoreEntry::mem_obj, MemObject::XitTable::open(), Ipc::StoreMap::openForReading(), and MemObject::xitTable.
|
overridevirtual |
Implements Store::Storage.
Definition at line 61 of file Transients.cc.
References Ipc::Mem::PageId::cachePage, StoreInfoStats::Part::capacity, StoreInfoStats::Part::count, currentCount(), StoreInfoStats::mem, Ipc::Mem::PageLevel(), Ipc::Mem::PageLimit(), Ipc::Mem::PageSize(), StoreInfoStats::Mem::shared, and StoreInfoStats::Part::size.
| bool Transients::hasWriter | ( | const StoreEntry & | e | ) |
Definition at line 265 of file Transients.cc.
References StoreEntry::hasTransients(), MemObject::XitTable::index, map, StoreEntry::mem_obj, Ipc::StoreMap::peekAtWriter(), and MemObject::xitTable.
|
overridevirtual |
Start preparing the store for use. To check readiness, callers should use readable() and writable() methods.
Implements Store::Storage.
Definition at line 46 of file Transients.cc.
References assert, Ipc::StoreMap::cleaner, Ipc::StoreMap::disableHitValidation(), Enabled(), EntryLimit(), locals, map, MapLabel, and Must.
Referenced by Store::Controller::init().
| bool Transients::isReader | ( | const StoreEntry & | e | ) | const |
Definition at line 375 of file Transients.cc.
References MemObject::XitTable::io, Store::ioReading, StoreEntry::mem_obj, and MemObject::xitTable.
Referenced by disconnect().
| bool Transients::isWriter | ( | const StoreEntry & | e | ) | const |
Definition at line 381 of file Transients.cc.
References MemObject::XitTable::io, Store::ioWriting, StoreEntry::mem_obj, and MemObject::xitTable.
Referenced by completeWriting(), disconnect(), and status().
|
overridevirtual |
Implements Store::Storage.
Definition at line 98 of file Transients.cc.
| bool Transients::markedForDeletion | ( | const cache_key * | key | ) | const |
Whether an entry with the given public key exists and (but) was marked for removal some time ago; get(key) returns nil in such cases.
Definition at line 368 of file Transients.cc.
References assert, map, and Ipc::StoreMap::markedForDeletion().
|
overridevirtual |
Implements Store::Storage.
Definition at line 131 of file Transients.cc.
|
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.
Definition at line 110 of file Transients.cc.
Referenced by stat().
|
overridevirtual |
Implements Store::Storage.
Definition at line 104 of file Transients.cc.
| void Transients::monitorIo | ( | StoreEntry * | e, |
| const cache_key * | key, | ||
| const Store::IoStatus | direction | ||
| ) |
start listening for remote DELETE requests targeting either a complete StoreEntry (ioReading) or a being-formed miss StoreEntry (ioWriting)
Definition at line 197 of file Transients.cc.
References addEntry(), assert, StoreEntry::hasTransients(), MemObject::XitTable::index, locals, StoreEntry::mem_obj, and MemObject::xitTable.
|
overrideprotectedvirtual |
Implements Ipc::StoreMapCleaner.
Definition at line 273 of file Transients.cc.
| int Transients::readers | ( | const StoreEntry & | e | ) | const |
Definition at line 302 of file Transients.cc.
References assert, StoreEntry::hasTransients(), MemObject::XitTable::index, Ipc::StoreMapAnchor::lock, map, StoreEntry::mem_obj, Ipc::StoreMap::peekAtEntry(), Ipc::ReadWriteLock::readers, and MemObject::xitTable.
|
overridevirtual |
Implements Store::Controlled.
Definition at line 138 of file Transients.cc.
|
overridevirtual |
Output stats to the provided store entry. TODO: make these calls asynchronous
Implements Store::Storage.
Definition at line 78 of file Transients.cc.
References currentCount(), currentSize(), Math::doublePercent(), Ipc::StoreMap::entryLimit(), map, maxSize(), PRId64, and storeAppendPrintf().
| void Transients::status | ( | const StoreEntry & | e, |
| Transients::EntryStatus & | entryStatus | ||
| ) | const |
Definition at line 279 of file Transients.cc.
References assert, StoreEntry::hasTransients(), Transients::EntryStatus::hasWriter, MemObject::XitTable::index, isWriter(), map, StoreEntry::mem_obj, Ipc::StoreMap::readableEntry(), Transients::EntryStatus::waitingToBeFreed, Ipc::StoreMap::writeableEntry(), and MemObject::xitTable.
|
inlinevirtualinherited |
Reimplemented in Fs::Ufs::UFSSwapDir, Store::Controller, and Store::Disks.
|
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().
|
private |
local collapsed reader and writer entries, indexed by transient ID, for syncing old StoreEntries
Definition at line 108 of file Transients.h.
Referenced by ~Transients(), disconnect(), findCollapsed(), get(), init(), and monitorIo().
|
private |
Definition at line 103 of file Transients.h.
Referenced by ~Transients(), addEntry(), addReaderEntry(), addWriterEntry(), completeWriting(), currentCount(), disconnect(), evictCached(), evictIfFound(), findCollapsed(), get(), hasWriter(), init(), markedForDeletion(), readers(), stat(), and status().