store_rebuild.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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 
16 class MemBuf;
17 
20 {
21 public:
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;
40  int zero_object_sz = 0;
41  int64_t validations = 0;
42  timeval startTime = {};
43 };
44 
46 class Progress
47 {
48 public:
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 
59 inline std::ostream &
60 operator <<(std::ostream &os, const Progress &p)
61 {
62  p.print(os);
63  return os;
64 }
65 
66 void storeRebuildStart(void);
68 void storeRebuildProgress(int sd_index, int total, int sofar);
69 
71 bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts);
73 bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize);
74 
75 #endif /* SQUID_STORE_REBUILD_H_ */
76 
int64_t completed
the number of finished work steps
Definition: store_rebuild.h:55
std::ostream & operator<<(std::ostream &os, const Progress &p)
Definition: store_rebuild.h:60
int64_t goal
the known total number of work steps (or negative)
Definition: store_rebuild.h:56
unsigned char cache_key
Store key.
Definition: forward.h:29
void updateStartTime(const timeval &dirStartTime)
maintain earliest initiation time across multiple indexing cache_dirs
cache_dir(s) indexing statistics
Definition: store_rebuild.h:19
void storeRebuildComplete(StoreRebuildData *)
Definition: MemBuf.h:23
timeval startTime
absolute time when the rebuild was initiated
Definition: store_rebuild.h:42
bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize)
parses entry buffer and validates entry metadata; fills e on success
void print(std::ostream &os) const
brief progress report suitable for level-0/1 debugging
advancement of work that consists of (usually known number) of similar steps
Definition: store_rebuild.h:46
bool started() const
whether we have worked on indexing this(these) cache_dir(s) before
Definition: store_rebuild.h:26
int64_t validations
the number of validated cache entries, slots
Definition: store_rebuild.h:41
static StoreRebuildData counts
void storeRebuildProgress(int sd_index, int total, int sofar)
bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts)
loads entry from disk; fills supplied memory buffer on success
Progress(const int64_t stepsCompleted, const int64_t stepsTotal)
Definition: store_rebuild.h:49
void storeRebuildStart(void)
void const char * buf
Definition: stub_helper.cc:16

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors