int Store::Controller::store_dirs_rebuilding = 1;
Store::Controller::Controller() :
- swapDir(new Disks),
+ disks(new Disks),
sharedMemStore(nullptr),
localMemStore(false),
transients(nullptr)
{
delete sharedMemStore;
delete transients;
- delete swapDir;
+ delete disks;
if (store_table) {
hashFreeItems(store_table, destroyStoreEntry);
}
}
- swapDir->init();
+ disks->init();
if (Transients::Enabled() && IamWorkerProcess()) {
transients = new Transients;
void
Store::Controller::create()
{
- swapDir->create();
+ disks->create();
#if !_SQUID_WINDOWS_
pid_t pid;
{
static time_t last_warn_time = 0;
- swapDir->maintain();
+ disks->maintain();
/* this should be emitted by the oversize dir, not globally */
}
}
- swapDir->getStats(stats);
+ disks->getStats(stats);
// low-level info not specific to memory or disk cache
stats.store_entry_count = StoreEntry::inUseCount();
if (sharedMemStore)
sharedMemStore->stat(output);
- /* now the swapDir */
- swapDir->stat(output);
+ disks->stat(output);
}
/* if needed, this could be taught to cache the result */
Store::Controller::maxSize() const
{
/* TODO: include memory cache ? */
- return swapDir->maxSize();
+ return disks->maxSize();
}
uint64_t
Store::Controller::minSize() const
{
/* TODO: include memory cache ? */
- return swapDir->minSize();
+ return disks->minSize();
}
uint64_t
Store::Controller::currentSize() const
{
/* TODO: include memory cache ? */
- return swapDir->currentSize();
+ return disks->currentSize();
}
uint64_t
Store::Controller::currentCount() const
{
/* TODO: include memory cache ? */
- return swapDir->currentCount();
+ return disks->currentCount();
}
int64_t
Store::Controller::maxObjectSize() const
{
/* TODO: include memory cache ? */
- return swapDir->maxObjectSize();
+ return disks->maxObjectSize();
}
void
Store::Controller::configure()
{
- swapDir->configure();
+ disks->configure();
store_swap_high = (long) (((float) maxSize() *
(float) Config.Swap.highWaterMark) / (float) 100);
// TODO: move this into a memory cache class when we have one
const int64_t memMax = static_cast<int64_t>(min(Config.Store.maxInMemObjSize, Config.memMaxSize));
- const int64_t disksMax = swapDir ? swapDir->maxObjectSize() : 0;
+ const int64_t disksMax = disks->maxObjectSize();
store_maxobjsize = std::max(disksMax, memMax);
}
{
if (sharedMemStore)
sharedMemStore->sync();
- swapDir->sync();
+ disks->sync();
}
/*
Store::Controller::callback()
{
/* mem cache callbacks ? */
- return swapDir->callback();
+ return disks->callback();
}
/// update reference counters of the recently touched entry
/* Notify the fs that we're referencing this object again */
if (e.hasDisk())
- swapDir->reference(e);
+ disks->reference(e);
// Notify the memory cache that we're referencing this object again
if (sharedMemStore && e.mem_status == IN_MEMORY)
// should be done even if we overwrite keepInStoreTable afterwards.
if (e.hasDisk())
- keepInStoreTable = swapDir->dereference(e) || keepInStoreTable;
+ keepInStoreTable = disks->dereference(e) || keepInStoreTable;
// Notify the memory cache that we're not referencing this object any more
if (sharedMemStore && e.mem_status == IN_MEMORY)
bool
Store::Controller::hasReadableDiskEntry(const StoreEntry &e) const
{
- return swapDir->hasReadableEntry(e);
+ return disks->hasReadableEntry(e);
}
/// flags problematic entries before find() commits to finalizing/returning them
}
}
- if (swapDir) {
- if (StoreEntry *e = swapDir->get(key)) {
- debugs(20, 3, "got disk-cached entry: " << *e);
- return e;
- }
+ if (const auto e = disks->get(key)) {
+ debugs(20, 3, "got disk-cached entry: " << *e);
+ return e;
}
debugs(20, 4, "cannot locate " << storeKeyText(key));
int64_t
Store::Controller::accumulateMore(StoreEntry &entry) const
{
- return swapDir ? swapDir->accumulateMore(entry) : 0;
+ return disks->accumulateMore(entry);
// The memory cache should not influence for-swapout accumulation decision.
}
if (transients)
transients->evictCached(e);
memoryEvictCached(e);
- if (swapDir)
- swapDir->evictCached(e);
+ disks->evictCached(e);
}
void
if (sharedMemStore)
sharedMemStore->evictIfFound(key);
- if (swapDir)
- swapDir->evictIfFound(key);
+
+ disks->evictIfFound(key);
+
if (transients)
transients->evictIfFound(key);
}
sharedMemStore->updateHeaders(old);
if (old->swap_dirn > -1)
- swapDir->updateHeaders(old);
+ disks->updateHeaders(old);
return true;
}
found = true;
inSync = sharedMemStore->updateAnchored(*collapsed);
// TODO: handle entries attached to both memory and disk
- } else if (swapDir && collapsed->hasDisk()) {
+ } else if (collapsed->hasDisk()) {
found = true;
- inSync = swapDir->updateAnchored(*collapsed);
+ inSync = disks->updateAnchored(*collapsed);
} else {
try {
found = anchorToCache(*collapsed);
} else if (sharedMemStore && entry.hasMemStore()) {
debugs(20, 5, "already anchored to memory store: " << entry);
return true;
- } else if (swapDir && entry.hasDisk()) {
+ } else if (entry.hasDisk()) {
debugs(20, 5, "already anchored to disk: " << entry);
return true;
}
bool found = false;
if (sharedMemStore)
found = sharedMemStore->anchorToCache(entry);
- if (!found && swapDir)
- found = swapDir->anchorToCache(entry);
+ if (!found)
+ found = disks->anchorToCache(entry);
if (found) {
debugs(20, 7, "anchored " << entry);