]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/stub_store_rebuild.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / tests / stub_store_rebuild.cc
1 /*
2 * Copyright (C) 1996-2021 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 "SquidTime.h"
14 #include "store/Controller.h"
15 #include "store_rebuild.h"
16
17 #include <cstring>
18
19 #define STUB_API "stub_store_rebuild.cc"
20 #include "tests/STUB.h"
21
22 void storeRebuildProgress(int sd_index, int total, int sofar) STUB
23 bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, StoreRebuildData &, uint64_t) STUB_RETVAL(false)
24
25 void StoreRebuildData::updateStartTime(const timeval &dirStartTime)
26 {
27 startTime = started() ? std::min(startTime, dirStartTime) : dirStartTime;
28 }
29
30 void storeRebuildComplete(StoreRebuildData *)
31 {
32 --StoreController::store_dirs_rebuilding;
33 if (StoreController::store_dirs_rebuilding == 1)
34 --StoreController::store_dirs_rebuilding; // normally in storeCleanup()
35 }
36
37 bool
38 storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &)
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