unsigned int clean:1;
} flags;
- struct _store_rebuild_data counts;
+ StoreRebuildData counts;
};
static char *storeCossDirSwapLogFile(SwapDir *, const char *);
#define SQUID_FS_ROCK_REBUILD_H
#include "base/AsyncJob.h"
-#include "structs.h"
+#include "cbdata.h"
+#include "store_rebuild.h"
namespace Rock
{
int64_t dbOffset;
int filen;
- struct _store_rebuild_data counts;
+ StoreRebuildData counts;
static void Steps(void *data);
#include "RefCount.h"
#include "UFSSwapDir.h"
-#include "structs.h"
#include "UFSSwapLogParser.h"
+#include "store_rebuild.h"
class StoreEntry;
char fullpath[MAXPATHLEN];
char fullfilename[MAXPATHLEN];
- struct _store_rebuild_data counts;
+ StoreRebuildData counts;
private:
CBDATA_CLASS2(RebuildState);
#if HAVE_ERRNO_H
#include <errno.h>
#endif
-static struct _store_rebuild_data counts;
+static StoreRebuildData counts;
static struct timeval rebuild_start;
static void storeCleanup(void *);
/* meta data recreated from disk image in swap directory */
void
-storeRebuildComplete(struct _store_rebuild_data *dc)
+storeRebuildComplete(StoreRebuildData *dc)
{
double dt;
counts.objcount += dc->objcount;
bool
storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf,
- struct _store_rebuild_data &counts)
+ StoreRebuildData &counts)
{
if (fd < 0)
return false;
bool
storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key,
- struct _store_rebuild_data &counts,
+ StoreRebuildData &counts,
uint64_t expectedSize)
{
int swap_hdr_len = 0;
bool
storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key,
- struct _store_rebuild_data &counts)
+ StoreRebuildData &counts)
{
/* this needs to become
* 1) unpack url
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
+class StoreRebuildData {
+public:
+ int objcount; /* # objects successfully reloaded */
+ int expcount; /* # objects expired */
+ int scancount; /* # entries scanned or read from state file */
+ int clashcount; /* # swapfile clashes avoided */
+ int dupcount; /* # duplicates purged */
+ int cancelcount; /* # SWAP_LOG_DEL objects purged */
+ int invalid; /* # bad lines */
+ int badflags; /* # bad e->flags */
+ int bad_log_op;
+ int zero_object_sz;
+};
extern void storeRebuildStart(void);
-extern void storeRebuildComplete(struct _store_rebuild_data *);
+extern void storeRebuildComplete(StoreRebuildData *);
extern void storeRebuildProgress(int sd_index, int total, int sofar);
/// loads entry from disk; fills supplied memory buffer on success
-extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, struct _store_rebuild_data &counts);
+extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts);
/// parses entry buffer and validates entry metadata; fills e on success
-extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, struct _store_rebuild_data &counts, uint64_t expectedSize);
+extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize);
/// checks whether the loaded entry should be kept; updates counters
-extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, struct _store_rebuild_data &counts);
+extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, StoreRebuildData &counts);
int del_count; /* number of deletions performed so far */
};
-struct _store_rebuild_data {
- int objcount; /* # objects successfully reloaded */
- int expcount; /* # objects expired */
- int scancount; /* # entries scanned or read from state file */
- int clashcount; /* # swapfile clashes avoided */
- int dupcount; /* # duplicates purged */
- int cancelcount; /* # SWAP_LOG_DEL objects purged */
- int invalid; /* # bad lines */
- int badflags; /* # bad e->flags */
- int bad_log_op;
- int zero_object_sz;
-};
-
#if USE_SSL
struct _sslproxy_cert_sign {
int alg;
#include "squid.h"
#include "MemBuf.h"
+#include "store_rebuild.h"
#define STUB_API "stub_store_rebuild.cc"
#include "tests/STUB.h"
void storeRebuildProgress(int sd_index, int total, int sofar) STUB
-void storeRebuildComplete(struct _store_rebuild_data *dc) STUB_NOP
-bool storeRebuildLoadEntry(int, int, MemBuf&, _store_rebuild_data&)
+void storeRebuildComplete(StoreRebuildData *dc) STUB_NOP
+bool storeRebuildLoadEntry(int, int, MemBuf&, StoreRebuildData&)
{
return false;
}
-bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, struct _store_rebuild_data &counts) STUB_RETVAL(false)
-bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, struct _store_rebuild_data &, uint64_t) STUB_RETVAL(false)
+bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, StoreRebuildData &counts) STUB_RETVAL(false)
+bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, StoreRebuildData &, uint64_t) STUB_RETVAL(false)