allows testing of methods without having all the other components live More...
#include <testStore.h>


Public Member Functions | |
TestStore () | |
virtual int | callback () |
called once every main loop iteration; TODO: Move to UFS code. More... | |
virtual StoreEntry * | get (const cache_key *) |
virtual void | get (String, void(*)(StoreEntry *, void *), void *) |
virtual void | init () |
virtual void | maintain () |
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain More... | |
virtual uint64_t | maxSize () const |
virtual uint64_t | minSize () const |
the minimum size the store will shrink to via normal housekeeping More... | |
virtual uint64_t | currentSize () const |
current size More... | |
virtual uint64_t | currentCount () const |
the total number of objects stored right now More... | |
virtual int64_t | maxObjectSize () const |
the maximum size of a storable object; -1 if unlimited More... | |
virtual void | getStats (StoreInfoStats &) const |
collect statistics More... | |
virtual void | stat (StoreEntry &) const |
virtual void | reference (StoreEntry &) |
virtual bool | dereference (StoreEntry &) |
virtual StoreSearch * | search () |
virtual void | create () override |
create system resources needed for this store to operate in the future More... | |
virtual void | sync () override |
prepare for shutdown More... | |
virtual void | evictCached (StoreEntry &) override |
virtual void | evictIfFound (const cache_key *) override |
StoreEntry * | find (const cache_key *) |
StoreEntry * | peek (const cache_key *) |
StoreEntry * | findCallbackXXX (const cache_key *) |
bool | markedForDeletion (const cache_key *key) const |
bool | markedForDeletionAndAbandoned (const StoreEntry &) const |
bool | hasReadableDiskEntry (const StoreEntry &) const |
whether there is a disk entry with e.key More... | |
int64_t | accumulateMore (StoreEntry &) const |
void | configure () |
update configuration, including limits (re)calculation More... | |
void | handleIdleEntry (StoreEntry &) |
called when the entry is no longer needed by any transaction More... | |
void | freeMemorySpace (const int spaceRequired) |
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, StoreEntry &e304) |
using a 304 response, update the old entry (metadata and reply headers) More... | |
bool | allowCollapsing (StoreEntry *, const RequestFlags &, const HttpRequestMethod &) |
tries to make the entry available for collapsing future requests More... | |
void | addReading (StoreEntry *, const cache_key *) |
void | addWriting (StoreEntry *, const cache_key *) |
bool | transientsReader (const StoreEntry &) const |
whether the entry is in "reading from Transients" I/O state More... | |
bool | transientsWriter (const StoreEntry &) const |
whether the entry is in "writing to Transients" I/O state 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 | stopSharing (StoreEntry &) |
stop any current (and prevent any future) SMP sharing of the given entry More... | |
int | transientReaders (const StoreEntry &) const |
number of the transient entry readers some time ago More... | |
void | transientsDisconnect (StoreEntry &) |
disassociates the entry from the intransit table More... | |
void | transientsClearCollapsingRequirement (StoreEntry &e) |
removes collapsing requirement (for future hits) More... | |
void | memoryDisconnect (StoreEntry &) |
disassociates the entry from the memory cache, preserving cached data More... | |
Static Public Member Functions | |
static bool | SmpAware () |
whether there are any SMP-aware storages More... | |
Public Attributes | |
bool | statsCalled |
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 | |
bool | memoryCacheHasSpaceFor (const int pagesRequired) const |
whether the memory cache is allowed to store that many additional pages More... | |
void | referenceBusy (StoreEntry &e) |
update reference counters of the recently touched entry More... | |
bool | dereferenceIdle (StoreEntry &, bool wantsLocalMemory) |
void | allowSharing (StoreEntry &, const cache_key *) |
indexes and adds SMP-tracking for an ephemeral peek() result More... | |
StoreEntry * | peekAtLocal (const cache_key *) |
void | memoryEvictCached (StoreEntry &) |
void | transientsUnlinkByKeyIfFound (const cache_key *) |
bool | keepForLocalMemoryCache (StoreEntry &e) const |
whether e should be kept in local RAM for possible future caching More... | |
bool | anchorToCache (StoreEntry &e, bool &inSync) |
void | checkTransients (const StoreEntry &) const |
void | checkFoundCandidate (const StoreEntry &) const |
flags problematic entries before find() commits to finalizing/returning them More... | |
Private Attributes | |
Disks * | swapDir |
summary view of all disk caches More... | |
Memory * | sharedMemStore |
memory cache that multiple workers can use More... | |
bool | localMemStore |
whether local (non-shared) memory cache is enabled More... | |
Transients * | transients |
int | memoryPagesDebt_ = 0 |
Hack: Relays page shortage from freeMemorySpace() to handleIdleEntry(). More... | |
Detailed Description
Definition at line 40 of file testStore.h.
Constructor & Destructor Documentation
◆ TestStore()
|
inline |
Definition at line 44 of file testStore.h.
Member Function Documentation
◆ accumulateMore()
|
inherited |
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 485 of file Controller.cc.
Referenced by StoreEntry::mayStartSwapOut().
◆ addReading()
|
inherited |
register a being-read StoreEntry (to optimize concurrent cache reads and to receive remote DELETE events)
Definition at line 771 of file Controller.cc.
References StoreEntry::hashInsert(), and Store::ioReading.
◆ addWriting()
|
inherited |
register a being-written StoreEntry (to support concurrent cache reads and to receive remote DELETE events)
Definition at line 779 of file Controller.cc.
References assert, EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, and Store::ioWriting.
Referenced by StoreEntry::setPublicKey().
◆ allowCollapsing()
|
inherited |
Definition at line 754 of file Controller.cc.
References debugs, StoreEntry::hasTransients(), ksDefault, ksRevalidation, StoreEntry::makePublic(), RequestFlags::refresh, and StoreEntry::setCollapsingRequirement().
Referenced by clientReplyContext::createStoreEntry().
◆ allowSharing()
|
privateinherited |
Definition at line 370 of file Controller.cc.
References DBG_IMPORTANT, debugs, StoreEntry::hasTransients(), Here, StoreEntry::hittingRequiresCollapsing(), and TexcHere.
◆ anchorToCache()
|
privateinherited |
Called for Transients 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 890 of file Controller.cc.
References assert, debugs, and StoreEntry::hasTransients().
◆ callback()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 17 of file testStore.cc.
◆ checkFoundCandidate()
|
privateinherited |
Definition at line 328 of file Controller.cc.
References StoreEntry::hasTransients(), Here, StoreEntry::hittingRequiresCollapsing(), StoreEntry::isAccepting(), and StoreEntry::locked().
◆ checkTransients()
|
privateinherited |
Definition at line 922 of file Controller.cc.
References assert, EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, and StoreEntry::hasTransients().
◆ configure()
|
inherited |
Definition at line 194 of file Controller.cc.
References Config, SquidConfig::highWaterMark, SquidConfig::lowWaterMark, max(), SquidConfig::maxInMemObjSize, SquidConfig::memMaxSize, min(), SquidConfig::Store, store_maxobjsize, store_pages_max, store_swap_high, store_swap_low, and SquidConfig::Swap.
Referenced by storeConfigure().
◆ create()
|
overridevirtualinherited |
Implements Store::Storage.
Definition at line 78 of file Controller.cc.
References pid, and WaitForAnyPid().
Referenced by SquidMain().
◆ currentCount()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 55 of file testStore.cc.
◆ currentSize()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 49 of file testStore.cc.
◆ dereference()
|
inlinevirtual |
Definition at line 74 of file testStore.h.
◆ dereferenceIdle()
|
privateinherited |
dereference()s an idle entry
- Returns
- false if and only if the entry should be deleted
Definition at line 262 of file Controller.cc.
References RemovalPolicy::Dereferenced, EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, StoreEntry::hasDisk(), StoreEntry::hittingRequiresCollapsing(), IN_MEMORY, KEY_PRIVATE, StoreEntry::mem_obj, mem_policy, StoreEntry::mem_status, and MemObject::repl.
◆ evictCached()
|
overridevirtualinherited |
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 495 of file Controller.cc.
References debugs.
Referenced by StoreEntry::release(), and StoreEntry::setPrivateKey().
◆ evictIfFound()
|
overridevirtualinherited |
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 Controller.cc.
References debugs, and storeKeyText().
Referenced by purgeEntriesByUrl().
◆ find()
|
inherited |
- Returns
- a locally indexed and SMP-tracked matching StoreEntry (or nil) Slower than peek() but does not restrict StoreEntry use and storage. Counts as an entry reference from the removal policy p.o.v.
Definition at line 349 of file Controller.cc.
Referenced by storeGetPublic(), and storeGetPublicByRequestMethod().
◆ findCallbackXXX()
|
inherited |
- Returns
- matching StoreEntry associated with local ICP/HTCP transaction Warning: The returned StoreEntry is not synced and may be marked for deletion. It can only be used for extracting transaction callback details. New code should be designed to avoid this deprecated API.
Definition at line 400 of file Controller.cc.
References hash_lookup(), and store_table.
Referenced by neighborsHtcpReply().
◆ freeMemorySpace()
|
inherited |
Evict memory cache entries to free at least spaceRequired
bytes. Should be called via storeGetMemSpace(). Unreliable: Fails if enough victims cannot be found fast enough.
Definition at line 535 of file Controller.cc.
References debugs, hot_obj_count, mem_policy, RemovalPolicy::PurgeInit, SM_PAGE_SIZE, and squid_curtime.
Referenced by storeGetMemSpace().
◆ get() [1/2]
|
virtual |
Definition at line 23 of file testStore.cc.
References NULL.
◆ get() [2/2]
|
virtual |
Definition at line 29 of file testStore.cc.
◆ getStats()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 67 of file testStore.cc.
◆ handleIdleEntry()
|
inherited |
Definition at line 672 of file Controller.cc.
References assert, debugs, destroyStoreEntry, EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, IN_MEMORY, KEY_PRIVATE, StoreEntry::mem_obj, StoreEntry::release(), StoreEntry::setMemStatus(), StoreEntry::swappedOut(), and MemObject::unlinkRequest().
Referenced by StoreEntry::doAbandon().
◆ hasReadableDiskEntry()
|
inherited |
Definition at line 321 of file Controller.cc.
◆ init()
|
virtual |
Start preparing the store for use. To check readiness, callers should use readable() and writable() methods.
Reimplemented from Store::Controller.
Definition at line 33 of file testStore.cc.
◆ keepForLocalMemoryCache()
|
privateinherited |
Definition at line 577 of file Controller.cc.
References assert, Config, MemObject::endOffset(), MemObject::expectedReplySize(), max(), SquidConfig::maxInMemObjSize, StoreEntry::mem_obj, SquidConfig::memMaxSize, StoreEntry::memoryCachable(), min(), and SquidConfig::Store.
◆ maintain()
|
inlinevirtual |
Reimplemented from Store::Controller.
Definition at line 56 of file testStore.h.
◆ markedForDeletion()
|
inherited |
Whether a transient 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 305 of file Controller.cc.
Referenced by Ipc::StoreMapAnchor::setKey().
◆ markedForDeletionAndAbandoned()
|
inherited |
markedForDeletion() with no readers this is one method because the two conditions must be checked in the right order
Definition at line 312 of file Controller.cc.
References hash_link::key.
◆ maxObjectSize()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 61 of file testStore.cc.
◆ maxSize()
|
virtual |
The maximum size the store will support in normal use. Inaccuracy is permitted, but may throw estimates for memory etc out of whack.
Reimplemented from Store::Controller.
Definition at line 37 of file testStore.cc.
◆ memoryCacheHasSpaceFor()
|
privateinherited |
Definition at line 526 of file Controller.cc.
References debugs, mem_node::InUseCount(), and store_pages_max.
◆ memoryDisconnect()
|
inherited |
Definition at line 622 of file Controller.cc.
Referenced by StoreEntry::destroyMemObject().
◆ memoryEvictCached()
|
privateinherited |
removes the entry from the memory cache XXX: Dangerous side effect: Unlocked entries lose their mem_obj.
Definition at line 611 of file Controller.cc.
References StoreEntry::destroyMemObject(), and StoreEntry::locked().
◆ memoryOut()
|
inherited |
Definition at line 594 of file Controller.cc.
References debugs, and StoreEntry::trimMemory().
Referenced by StoreEntry::swapOut().
◆ minSize()
|
virtual |
Reimplemented from Store::Controller.
Definition at line 43 of file testStore.cc.
◆ peek()
|
inherited |
- Returns
- a matching StoreEntry not suitable for long-term use (or nil) Faster than find() but the returned entry may not receive updates, may lack information from some of the Stores, and should not be updated except that purging peek()ed entries is supported. Does not count as an entry reference from the removal policy p.o.v.
Definition at line 432 of file Controller.cc.
References debugs, and storeKeyText().
◆ peekAtLocal()
|
privateinherited |
- Returns
- either an existing local reusable StoreEntry object or nil To treat remotely marked entries specially, callers ought to check markedForDeletion() first!
Definition at line 416 of file Controller.cc.
References assert, EBIT_TEST, hash_lookup(), KEY_PRIVATE, and store_table.
◆ reference()
|
inlinevirtual |
Definition at line 72 of file testStore.h.
◆ referenceBusy()
|
privateinherited |
Definition at line 237 of file Controller.cc.
References EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, StoreEntry::hasDisk(), IN_MEMORY, StoreEntry::mem_obj, mem_policy, StoreEntry::mem_status, RemovalPolicy::Referenced, and MemObject::repl.
◆ search()
|
virtual |
Definition at line 78 of file testStore.cc.
References NULL.
◆ SmpAware()
|
staticinherited |
Definition at line 916 of file Controller.cc.
References MemStore::Enabled(), and Store::Disks::SmpAware().
Referenced by Transients::EntryLimit(), and clientReplyContext::processExpired().
◆ stat()
|
virtual |
Output stats to the provided store entry. TODO: make these calls asynchronous
Reimplemented from Store::Controller.
Definition at line 72 of file testStore.cc.
References statsCalled.
◆ stopSharing()
|
inherited |
Definition at line 630 of file Controller.cc.
References StoreEntry::hasTransients().
Referenced by Rock::SwapDir::disconnect(), MemStore::disconnect(), StoreEntry::transientsAbandonmentCheck(), and Rock::SwapDir::writeError().
◆ sync()
|
overridevirtualinherited |
Reimplemented from Store::Storage.
Definition at line 218 of file Controller.cc.
Referenced by SquidShutdown().
◆ syncCollapsed()
|
inherited |
Definition at line 791 of file Controller.cc.
References StoreEntry::abort(), Transients::EntryStatus::abortedByWriter, assert, Transients::EntryStatus::collapsed, debugs, EBIT_TEST, ENTRY_ABORTED, StoreEntry::flags, StoreEntry::hasDisk(), StoreEntry::hasMemStore(), StoreEntry::hittingRequiresCollapsing(), StoreEntry::invokeHandlers(), MemObject::MemCache::io, MemObject::ioDone, StoreEntry::locked(), StoreEntry::mem_obj, MemObject::memCache, StoreEntry::release(), StoreEntry::setCollapsingRequirement(), and Transients::EntryStatus::waitingToBeFreed.
Referenced by CollapsedForwarding::HandleNewData().
◆ transientReaders()
|
inherited |
Definition at line 651 of file Controller.cc.
References StoreEntry::hasTransients().
Referenced by CollapsedForwarding::Broadcast().
◆ transientsClearCollapsingRequirement()
|
inherited |
Definition at line 665 of file Controller.cc.
Referenced by StoreEntry::startWriting().
◆ transientsCompleteWriting()
|
inherited |
Definition at line 640 of file Controller.cc.
References StoreEntry::hasTransients().
Referenced by MemStore::completeWriting(), and storeSwapOutFileClosed().
◆ transientsDisconnect()
|
inherited |
Definition at line 658 of file Controller.cc.
Referenced by StoreEntry::destroyMemObject().
◆ transientsReader()
|
inherited |
Definition at line 473 of file Controller.cc.
References StoreEntry::hasTransients().
◆ transientsUnlinkByKeyIfFound()
|
privateinherited |
◆ transientsWriter()
|
inherited |
Definition at line 479 of file Controller.cc.
References StoreEntry::hasTransients().
◆ updateOnNotModified()
|
inherited |
Definition at line 721 of file Controller.cc.
References MemObject::appliedUpdates, debugs, EBIT_TEST, ENTRY_SPECIAL, StoreEntry::flags, IN_MEMORY, StoreEntry::mem_obj, StoreEntry::mem_status, Must, StoreEntry::swap_dirn, and StoreEntry::updateOnNotModified().
Referenced by clientReplyContext::handleIMSReply(), and peerDigestFetchReply().
Member Data Documentation
◆ localMemStore
|
privateinherited |
Definition at line 159 of file Controller.h.
◆ memoryPagesDebt_
|
privateinherited |
Definition at line 167 of file Controller.h.
◆ sharedMemStore
|
privateinherited |
Definition at line 158 of file Controller.h.
◆ statsCalled
bool TestStore::statsCalled |
Definition at line 46 of file testStore.h.
Referenced by stat(), and testStore::testStats().
◆ store_dirs_rebuilding
|
staticinherited |
Definition at line 139 of file Controller.h.
Referenced by Store::Disks::configure(), Fs::Ufs::UFSSwapDir::HandleCleanEvent(), icpGetCommonOpcode(), Store::Disks::init(), Fs::Ufs::UFSSwapDir::maintain(), StoreEntry::release(), storeCleanup(), storeDirWriteCleanLogs(), testRock::storeInit(), storeLateRelease(), storeRebuildComplete(), Rock::Rebuild::swanSong(), testUfs::testUfsSearch(), wccp2HereIam(), and Fs::Ufs::UFSSwapDir::writeCleanDone().
◆ swapDir
|
privateinherited |
Definition at line 157 of file Controller.h.
◆ transients
|
privateinherited |
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 164 of file Controller.h.
The documentation for this class was generated from the following files:
- src/tests/testStore.h
- src/tests/testStore.cc