#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.am,v 1.91 2003/10/16 21:40:17 robertc Exp $
+# $Id: Makefile.am,v 1.92 2003/10/20 11:23:38 robertc Exp $
#
# Uncomment and customize the following to suit your needs:
#
int.cc \
ufsdump.cc \
store.cc \
+ StoreFileSystem.cc \
StoreMeta.cc \
StoreMeta.h \
StoreMetaMD5.cc \
comm_select.cc \
comm_poll.cc \
comm_kqueue.cc \
- comm_epoll.cc \
defines.h \
$(DELAY_POOL_SOURCE) \
disk.cc \
/*
- * $Id: StoreClient.h,v 1.10 2003/07/11 04:02:01 robertc Exp $
+ * $Id: StoreClient.h,v 1.11 2003/10/20 11:23:38 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void callback(ssize_t len, bool error = false);
void doCopy (StoreEntry *e);
void readHeader(const char *buf, ssize_t len);
- bool callbackPending() const;
void copy(StoreEntry *, StoreIOBuffer, STCB *, void *);
void dumpStats(StoreEntry * output, int clientNumber) const;
int type;
bool object_ok;
+ /* Until we finish stuffing code into store_client */
+
+public:
+
struct Callback
{
Callback ():callback_handler(NULL), callback_data(NULL){}
Callback (STCB *, void *);
+ bool pending() const;
STCB *callback_handler;
void *callback_data;
}
/*
- * $Id: stmem.cc,v 1.84 2003/10/20 03:57:25 robertc Exp $
+ * $Id: stmem.cc,v 1.85 2003/10/20 11:23:37 robertc Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Harvest Derived
void
mem_hdr::internalAppend(const char *data, int len)
{
- debug(19, 6) ("memInternalAppend: len %d\n", len);
+ debugs(19, 6, "memInternalAppend: len " << len);
while (len > 0) {
makeAppendSpace();
* we supply 0-500 and stop.
*/
ssize_t
-mem_hdr::copy(off_t offset, char *buf, size_t size) const
+mem_hdr::copy(StoreIOBuffer const &target) const
{
- debugs(19, 6, "memCopy: offset " << offset << ": size " << size);
+ debugs(19, 6, "memCopy: " << target.range());
/* we shouldn't ever ask for absent offsets */
}
/* RC: the next assert is nearly useless */
- assert(size > 0);
+ assert(target.length > 0);
/* Seek our way into store */
- mem_node *p = getBlockContainingLocation((size_t)offset);
+ mem_node *p = getBlockContainingLocation((size_t)target.offset);
if (!p) {
- debugs(19, 1, "memCopy: could not find offset " << offset <<
+ debugs(19, 1, "memCopy: could not find start of " << target.range() <<
" in memory.");
debugDump();
fatal("Squid has attempted to read data from memory that is not present. This is an indication of of (pre-3.0) code that hasn't been updated to deal with sparse objects in memory. Squid should coredump.allowing to review the cause. Immediately preceeding this message is a dump of the available data in the format [start,end). The [ means from the value, the ) means up to the value. I.e. [1,5) means that there are 4 bytes of data, at offsets 1,2,3,4.\n");
return 0;
}
- size_t bytes_to_go = size;
- char *ptr_to_buf = buf;
- off_t location = offset;
+ size_t bytes_to_go = target.length;
+ char *ptr_to_buf = target.data;
+ off_t location = target.offset;
/* Start copying begining with this block until
* we're satiated */
/* hit a sparse patch */
if (bytes_to_copy == 0)
- return size - bytes_to_go;
+ return target.length - bytes_to_go;
location += bytes_to_copy;
p = getBlockContainingLocation(location);
}
- return size - bytes_to_go;
+ return target.length - bytes_to_go;
}
bool
mem_hdr::write (StoreIOBuffer const &writeBuffer)
{
PROF_start(mem_hdr_write);
- // mem_node *tempNode;
- debug(19, 6) ("mem_hdr::write: offset %lu len %ld, object end %lu\n", (unsigned long)writeBuffer.offset, (long)writeBuffer.length, (unsigned long)endOffset());
+ debugs(19, 6, "mem_hdr::write: " << writeBuffer.range() << " object end " << endOffset());
if (unionNotEmpty(writeBuffer)) {
fatal("Attempt to overwrite already in-memory data\n");
void
mem_hdr::dump() const
{
- debug(20, 1) ("mem_hdr: %p nodes.start() %p\n", this, nodes.start());
- debug(20, 1) ("mem_hdr: %p nodes.finish() %p\n", this, nodes.finish());
+ debugs(20, 1, "mem_hdr: " << (void *)this << " nodes.start() " << nodes.start());
+ debugs(20, 1, "mem_hdr: " << (void *)this << " nodes.finish() " << nodes.finish());
}
size_t
/*
- * $Id: stmem.h,v 1.6 2003/09/22 08:50:51 robertc Exp $
+ * $Id: stmem.h,v 1.7 2003/10/20 11:23:38 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
int lowestOffset () const;
off_t endOffset () const;
int freeDataUpto (int);
- ssize_t copy (off_t, char *, size_t) const;
+ ssize_t copy (StoreIOBuffer const &) const;
bool hasContigousContentRange(Range<size_t> const &range) const;
/* success or fail */
bool write (StoreIOBuffer const &);
/*
- * $Id: store_client.cc,v 1.133 2003/08/10 05:11:22 robertc Exp $
+ * $Id: store_client.cc,v 1.134 2003/10/20 11:23:38 robertc Exp $
*
* DEBUG: section 90 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
}
result.offset = cmp_offset;
- assert(callbackPending());
+ assert(_callback.pending());
cmp_offset = copyInto.offset + sz;
STCB *temphandler = _callback.callback_handler;
void *cbdata = _callback.callback_data;
assert (sc->flags.copy_event_pending);
sc->flags.copy_event_pending = 0;
- if (!sc->callbackPending())
+ if (!sc->_callback.pending())
return;
storeClientCopy2(sc->entry, sc);
assert(this == storeClientListSearch(entry->mem_obj, data));
#endif
- assert(!callbackPending());
+ assert(!_callback.pending());
#if ONLYCONTIGUOUSREQUESTS
assert(cmp_offset == copyRequest.offset);
}
debug(90, 3)("storeClientCopy2: %s\n", e->getMD5Text());
- assert(sc->callbackPending());
+ assert(sc->_callback.pending());
/*
* We used to check for ENTRY_ABORTED here. But there were some
* problems. For example, we might have a slow client (or two) and
/* What the client wants is in memory */
/* Old style */
debug(90, 3)("store_client::doCopy: Copying normal from memory\n");
- MemObject *mem = entry->mem_obj;
- size_t sz = mem->data_hdr.copy(copyInto.offset, copyInto.data,
- copyInto.length);
+ size_t sz = entry->mem_obj->data_hdr.copy(copyInto);
callback(sz);
flags.store_copying = 0;
}
{
MemObject *mem = entry->mem_obj;
- assert(callbackPending());
+ assert(_callback.pending());
assert(!flags.disk_io_pending);
flags.disk_io_pending = 1;
store_client *sc = (store_client *)data;
assert(sc->flags.disk_io_pending);
sc->flags.disk_io_pending = 0;
- assert(sc->callbackPending());
+ assert(sc->_callback.pending());
debug(90, 3)("storeClientReadBody: len %d", (int) len);
if (sc->copyInto.offset == 0 && len > 0 && sc->entry->getReply()->sline.status == 0)
* not synchronous
*/
- if (callbackPending())
+ if (_callback.pending())
callback(0, true);
}
assert(flags.disk_io_pending);
flags.disk_io_pending = 0;
- assert(callbackPending());
+ assert(_callback.pending());
unpackHeader (buf, len);
#endif
- if (!sc->callbackPending())
+ if (!sc->_callback.pending())
return 0;
return 1;
statCounter.swap.ins++;
}
- if (sc->callbackPending()) {
+ if (sc->_callback.pending()) {
/* callback with ssize = -1 to indicate unexpected termination */
debug(90, 3) ("storeUnregister: store_client for %s has a callback\n",
mem->url);
nx = node->next;
debug(90, 3) ("InvokeHandlers: checking client #%d\n", i++);
- if (!sc->callbackPending())
+ if (!sc->_callback.pending())
continue;
if (sc->flags.disk_io_pending)
static int
CheckQuickAbort2(StoreEntry * entry)
{
- size_t curlen;
- size_t minlen;
- size_t expectlen;
MemObject * const mem = entry->mem_obj;
assert(mem);
debug(90, 3) ("CheckQuickAbort2: entry=%p, mem=%p\n", entry, mem);
return 1;
}
- expectlen = entry->getReply()->content_length + entry->getReply()->hdr_sz;
+ size_t expectlen = entry->getReply()->content_length + entry->getReply()->hdr_sz;
if (expectlen < 0)
/* expectlen is < 0 if *no* information about the object has been recieved */
return 1;
- curlen = (size_t) mem->endOffset ();
+ size_t curlen = (size_t) mem->endOffset ();
- minlen = (size_t) Config.quickAbort.min << 10;
+ size_t minlen = (size_t) Config.quickAbort.min << 10;
if (minlen < 0) {
debug(90, 3) ("CheckQuickAbort2: NO disabled\n");
void
store_client::dumpStats(StoreEntry * output, int clientNumber) const
{
- if (callbackPending())
+ if (_callback.pending())
return;
storeAppendPrintf(output, "\tClient #%d, %p\n", clientNumber, _callback.callback_data);
}
bool
-store_client::callbackPending() const
+store_client::Callback::pending() const
{
- return _callback.callback_handler && _callback.callback_data;
+ return callback_handler && callback_data;
}
store_client::Callback::Callback(STCB *function, void *data) : callback_handler(function), callback_data (data) {}