virtual const char *getMD5Text() const;
StoreEntry();
StoreEntry(const char *url, const char *log_url);
- virtual ~StoreEntry() {}
+ virtual ~StoreEntry();
virtual HttpReply const *getReply() const;
virtual void write (StoreIOBuffer);
assert(valid(fileno));
Slot &s = shared->slots[fileno];
assert(s.state == Slot::Writing);
+ ++s.readLevel;
++shared->count;
assert(s.state.swap_if(Slot::Writing, Slot::Usable));
}
/// start writing a new entry
StoreEntryBasics *openForWriting(const cache_key *const key, sfileno &fileno);
- /// finish writing a new entry
+ /// finish writing a new entry, leaves the entry opened for reading
void closeForWriting(const sfileno fileno);
/// mark slot as waiting to be freed, will be freed when no one uses it
EBIT_CLR(e->flags, RELEASE_REQUEST);
EBIT_CLR(e->flags, KEY_PRIVATE);
EBIT_SET(e->flags, ENTRY_VALIDATED);
-
e->hashInsert(key);
trackReferences(*e);
// the disk entry remains open for reading, protected from modifications
}
+void
+Rock::SwapDir::closeForReading(StoreEntry &e)
+{
+ assert(index == e.swap_dirn);
+ assert(e.swap_filen >= 0);
+ map->closeForReading(e.swap_filen);
+ e.swap_dirn = -1;
+ e.swap_filen = -1;
+}
+
// TODO: encapsulate as a tool; identical to CossSwapDir::create()
void
Rock::SwapDir::create()
#include "SwapDir.h"
#include "DiskIO/IORequestor.h"
-#include "rock/RockDirMap.h"
+#include "fs/rock/RockDirMap.h"
class DiskIOStrategy;
class DiskFile;
virtual StoreSearch *search(String const url, HttpRequest *);
virtual StoreEntry *get(const cache_key *key);
+ void closeForReading(StoreEntry &e);
+
protected:
/* protected ::SwapDir API */
virtual void create();
#include "SquidTime.h"
#include "swap_log_op.h"
#include "mgr/StoreIoAction.h"
+#include "fs/rock/RockSwapDir.h"
static STMCB storeWriteComplete;
swap_dirn = -1;
}
+StoreEntry::~StoreEntry()
+{
+ if (swap_filen >= 0) {
+ // XXX: support cache types other than Rock
+ Rock::SwapDir &rockSwapDir =
+ dynamic_cast<Rock::SwapDir &>(*store());
+ rockSwapDir.closeForReading(*this);
+ }
+}
+
void
StoreEntry::destroyMemObject()
{