TestSwapDir.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 #ifndef SQUID_SRC_TESTS_TESTSWAPDIR_H
10 #define SQUID_SRC_TESTS_TESTSWAPDIR_H
11 
12 #include "store/Disk.h"
13 
14 class TestSwapDir : public SwapDir
15 {
16 
17 public:
18  TestSwapDir() : SwapDir("test"), statsCalled (false) {}
19 
21 
22  /* Store::Disk API */
23  uint64_t maxSize() const override;
24  uint64_t currentSize() const override;
25  uint64_t currentCount() const override;
26  void stat(StoreEntry &) const override;
27  void finalizeSwapoutSuccess(const StoreEntry &) override {}
28  void finalizeSwapoutFailure(StoreEntry &) override {}
29  void reconfigure() override;
30  void init() override;
31  bool unlinkdUseful() const override;
32  bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override;
35  void parse(int, char*) override;
36  void evictCached(StoreEntry &) override {}
37  void evictIfFound(const cache_key *) override {}
38  bool hasReadableEntry(const StoreEntry &) const override { return false; }
39  bool smpAware() const override { return false; }
40 };
41 
43 
44 #endif /* SQUID_SRC_TESTS_TESTSWAPDIR_H */
45 
void evictCached(StoreEntry &) override
Definition: TestSwapDir.h:36
manages a single cache_dir
Definition: Disk.h:21
unsigned char cache_key
Store key.
Definition: forward.h:29
uint64_t maxSize() const override
Definition: TestSwapDir.cc:13
bool smpAware() const override
whether this disk storage is capable of serving multiple workers
Definition: TestSwapDir.h:39
StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override
Definition: TestSwapDir.cc:64
bool statsCalled
Definition: TestSwapDir.h:20
void stat(StoreEntry &) const override
Definition: TestSwapDir.cc:31
void init() override
Definition: TestSwapDir.cc:41
bool unlinkdUseful() const override
whether SwapDir may benefit from unlinkd
Definition: TestSwapDir.cc:45
bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override
check whether we can store the entry; if we can, report current load
Definition: TestSwapDir.cc:51
RefCount< TestSwapDir > TestSwapDirPointer
Definition: TestSwapDir.h:42
bool hasReadableEntry(const StoreEntry &) const override
whether this cache dir has an entry with e.key
Definition: TestSwapDir.h:38
void STIOCB(void *their_data, int errflag, StoreIOState::Pointer self)
Definition: StoreIOState.h:39
void finalizeSwapoutFailure(StoreEntry &) override
abort the failed swapout that has been already noticed by Store
Definition: TestSwapDir.h:28
void finalizeSwapoutSuccess(const StoreEntry &) override
finalize the successful swapout that has been already noticed by Store
Definition: TestSwapDir.h:27
uint64_t currentCount() const override
the total number of objects stored right now
Definition: TestSwapDir.cc:25
void evictIfFound(const cache_key *) override
Definition: TestSwapDir.h:37
StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override
Definition: TestSwapDir.cc:58
void reconfigure() override
Definition: TestSwapDir.cc:37
void parse(int, char *) override
Definition: TestSwapDir.cc:70
uint64_t currentSize() const override
current size
Definition: TestSwapDir.cc:19

 

Introduction

Documentation

Support

Miscellaneous