stub_store_rebuild.cc
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 84 Helper process maintenance */
10 
11 #include "squid.h"
12 #include "MemBuf.h"
13 #include "store/Controller.h"
14 #include "store_rebuild.h"
15 #include "time/gadgets.h"
16 
17 #include <cstring>
18 
19 #define STUB_API "stub_store_rebuild.cc"
20 #include "tests/STUB.h"
21 
22 void storeRebuildProgress(int, int, int) STUB
24 
25 void StoreRebuildData::updateStartTime(const timeval &dirStartTime)
26 {
27  startTime = started() ? std::min(startTime, dirStartTime) : dirStartTime;
28 }
29 
31 {
34  --StoreController::store_dirs_rebuilding; // normally in storeCleanup()
35 }
36 
37 bool
39 {
40  if (fd < 0)
41  return false;
42 
43  assert(buf.hasSpace()); // caller must allocate
44  // this stub simulates reading an empty entry
45  memset(buf.space(), 0, buf.spaceSize());
46  buf.appended(buf.spaceSize());
47  return true;
48 }
49 
50 void Progress::print(std::ostream &) const STUB
51 
unsigned char cache_key
Store key.
Definition: forward.h:29
bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key, StoreRebuildData &stats, uint64_t expectedSize)
parses entry buffer and validates entry metadata; fills e on success
cache_dir(s) indexing statistics
Definition: store_rebuild.h:20
void storeRebuildComplete(StoreRebuildData *)
Definition: MemBuf.h:24
#define assert(EX)
Definition: assert.h:19
char * space()
returns buffer after data; does not check space existence
Definition: MemBuf.h:57
#define STUB
macro to stub a void function.
Definition: STUB.h:33
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
Definition: Controller.h:139
void appended(mb_size_t sz)
updates content size after external append
Definition: MemBuf.cc:226
void print(std::ostream &os) const
brief progress report suitable for level-0/1 debugging
bool storeRebuildLoadEntry(int fd, int, MemBuf &buf, StoreRebuildData &)
loads entry from disk; fills supplied memory buffer on success
mb_size_t spaceSize() const
Definition: MemBuf.cc:155
void storeRebuildProgress(int, int, int) STUB bool storeRebuildParseEntry(MemBuf &
bool hasSpace() const
Definition: MemBuf.h:72
A const & min(A const &lhs, A const &rhs)
void StoreEntry cache_key StoreRebuildData uint64_t STUB_RETVAL(false) void StoreRebuildData

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors