SwapOut swapout;
- /* TODO: Remove this change-minimizing hack */
- using Io = Store::IoStatus;
- static constexpr Io ioUndecided = Store::ioUndecided;
- static constexpr Io ioReading = Store::ioReading;
- static constexpr Io ioWriting = Store::ioWriting;
- static constexpr Io ioDone = Store::ioDone;
-
/// State of an entry with regards to the [shared] in-transit table.
class XitTable
{
public:
/// associate our StoreEntry with a Transients entry at the given index
- void open(const int32_t anIndex, const Io anIo)
+ void open(const int32_t anIndex, const Store::IoStatus anIo)
{
index = anIndex;
io = anIo;
}
int32_t index = -1; ///< entry position inside the in-transit table
- Io io = ioUndecided; ///< current I/O state
+ Store::IoStatus io = Store::ioUndecided; ///< current I/O state
};
XitTable xitTable; ///< current [shared] memory caching state for the entry
int32_t index = -1; ///< entry position inside the memory cache
int64_t offset = 0; ///< bytes written/read to/from the memory cache so far
- Io io = ioUndecided; ///< current I/O state
+ Store::IoStatus io = Store::ioUndecided; ///< current I/O state
};
MemCache memCache; ///< current [shared] memory caching state for the entry
#include "sbuf/Stream.h"
#include "SquidConfig.h"
#include "SquidMath.h"
+#include "store/forward.h"
#include "StoreStats.h"
#include "tools.h"
MemStore::anchorToCache(StoreEntry &entry)
{
Assure(!entry.hasMemStore());
- Assure(entry.mem().memCache.io != MemObject::ioDone);
+ Assure(entry.mem().memCache.io != Store::ioDone);
if (!map)
return false;
MemObject::MemCache &mc = e.mem_obj->memCache;
mc.index = index;
- mc.io = MemObject::ioReading;
+ mc.io = Store::ioReading;
}
/// copies the entire entry from shared to local memory
assert(e.mem_obj);
e.mem_obj->memCache.index = index;
- e.mem_obj->memCache.io = MemObject::ioWriting;
+ e.mem_obj->memCache.io = Store::ioWriting;
slot->set(e);
// Do not allow others to feed off an unknown-size entry because we will
// stop swapping it out if it grows too large.
debugs(20, 7, "entry " << e);
switch (e.mem_obj->memCache.io) {
- case MemObject::ioUndecided:
+ case Store::ioUndecided:
if (!shouldCache(e) || !startCaching(e)) {
- e.mem_obj->memCache.io = MemObject::ioDone;
+ e.mem_obj->memCache.io = Store::ioDone;
e.memOutDecision(false);
return;
}
break;
- case MemObject::ioDone:
- case MemObject::ioReading:
+ case Store::ioDone:
+ case Store::ioReading:
return; // we should not write in all of the above cases
- case MemObject::ioWriting:
+ case Store::ioWriting:
break; // already decided to write and still writing
}
debugs(20, 5, "mem-cached all " << e.mem_obj->memCache.offset << " bytes of " << e);
e.mem_obj->memCache.index = -1;
- e.mem_obj->memCache.io = MemObject::ioDone;
+ e.mem_obj->memCache.io = Store::ioDone;
map->closeForWriting(index);
CollapsedForwarding::Broadcast(e);
assert(e.mem_obj);
MemObject &mem_obj = *e.mem_obj;
if (e.hasMemStore()) {
- if (mem_obj.memCache.io == MemObject::ioWriting) {
+ if (mem_obj.memCache.io == Store::ioWriting) {
map->abortWriting(mem_obj.memCache.index);
mem_obj.memCache.index = -1;
- mem_obj.memCache.io = MemObject::ioDone;
+ mem_obj.memCache.io = Store::ioDone;
CollapsedForwarding::Broadcast(e);
e.storeWriterDone();
} else {
- assert(mem_obj.memCache.io == MemObject::ioReading);
+ assert(mem_obj.memCache.io == Store::ioReading);
map->closeForReading(mem_obj.memCache.index);
mem_obj.memCache.index = -1;
- mem_obj.memCache.io = MemObject::ioDone;
+ mem_obj.memCache.io = Store::ioDone;
}
}
}
#include "SquidMath.h"
#include "store/Controller.h"
#include "store/Disks.h"
+#include "store/forward.h"
#include "store/LocalSearch.h"
#include "tools.h"
#include "Transients.h"
bool found = false;
bool inSync = false;
- if (sharedMemStore && collapsed->mem_obj->memCache.io == MemObject::ioDone) {
+ if (sharedMemStore && collapsed->mem_obj->memCache.io == Store::ioDone) {
found = true;
inSync = true;
debugs(20, 7, "already handled by memory store: " << *collapsed);
// TODO: Attach entries to both memory and disk
// TODO: Reduce code duplication with syncCollapsed()
- if (sharedMemStore && entry.mem().memCache.io == MemObject::ioDone) {
+ if (sharedMemStore && entry.mem().memCache.io == Store::ioDone) {
debugs(20, 5, "already handled by memory store: " << entry);
return true;
} else if (sharedMemStore && entry.hasMemStore()) {