store_rebuild.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 20 Store Rebuild Routines */
10
11#ifndef SQUID_STORE_REBUILD_H_
12#define SQUID_STORE_REBUILD_H_
13
14#include "store_key_md5.h"
15
16class MemBuf;
17
20{
21public:
23 void updateStartTime(const timeval &dirStartTime);
24
26 bool started() const { return startTime.tv_sec > 0; }
27
28 // when adding members, keep the class compatible with placement new onto a
29 // zeroed shared memory segment (see Rock::Rebuild::Stats usage)
30
31 int objcount = 0; /* # objects successfully reloaded */
32 int expcount = 0; /* # objects expired */
33 int scancount = 0; /* # entries scanned or read from state file */
34 int clashcount = 0; /* # swapfile clashes avoided */
35 int dupcount = 0; /* # duplicates purged */
36 int cancelcount = 0; /* # SWAP_LOG_DEL objects purged */
37 int invalid = 0; /* # bad lines */
38 int badflags = 0; /* # bad e->flags */
39 int bad_log_op = 0;
41 int64_t validations = 0;
42 timeval startTime = {};
43};
44
47{
48public:
49 Progress(const int64_t stepsCompleted, const int64_t stepsTotal):
50 completed(stepsCompleted), goal(stepsTotal) {}
51
53 void print(std::ostream &os) const;
54
55 int64_t completed;
56 int64_t goal;
57};
58
59inline std::ostream &
60operator <<(std::ostream &os, const Progress &p)
61{
62 p.print(os);
63 return os;
64}
65
66void storeRebuildStart(void);
68void storeRebuildProgress(int sd_index, int total, int sofar);
69
71bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts);
72
85bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize);
86
87#endif /* SQUID_STORE_REBUILD_H_ */
88
Definition: MemBuf.h:24
advancement of work that consists of (usually known number) of similar steps
Definition: store_rebuild.h:47
Progress(const int64_t stepsCompleted, const int64_t stepsTotal)
Definition: store_rebuild.h:49
int64_t goal
the known total number of work steps (or negative)
Definition: store_rebuild.h:56
void print(std::ostream &os) const
brief progress report suitable for level-0/1 debugging
int64_t completed
the number of finished work steps
Definition: store_rebuild.h:55
cache_dir(s) indexing statistics
Definition: store_rebuild.h:20
void updateStartTime(const timeval &dirStartTime)
maintain earliest initiation time across multiple indexing cache_dirs
bool started() const
whether we have worked on indexing this(these) cache_dir(s) before
Definition: store_rebuild.h:26
timeval startTime
absolute time when the rebuild was initiated
Definition: store_rebuild.h:42
int64_t validations
the number of validated cache entries, slots
Definition: store_rebuild.h:41
unsigned char cache_key
Store key.
Definition: forward.h:29
static StoreRebuildData counts
void storeRebuildProgress(int sd_index, int total, int sofar)
void storeRebuildComplete(StoreRebuildData *)
std::ostream & operator<<(std::ostream &os, const Progress &p)
Definition: store_rebuild.h:60
bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts)
loads entry from disk; fills supplied memory buffer on success
bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize)
void storeRebuildStart(void)

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors