testStore.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_TEST_STORE_H
10#define SQUID_SRC_TEST_STORE_H
11
12#include "Store.h"
13#include "store/Controlled.h"
14
15#include "compat/cppunit.h"
16
17/*
18 * test the store framework
19 */
20
21class TestStore: public CPPUNIT_NS::TestFixture
22{
30
31public:
32
33protected:
34 void testSetRoot();
35 void testUnsetRoot();
36 void testStats();
37 void testMaxSize();
39};
40
43{
44
45public:
47
49
50 int callback() override;
51
52 virtual StoreEntry* get(const cache_key*);
53
54 virtual void get(String, void (*)(StoreEntry*, void*), void*);
55
56 void init() override;
57
58 void maintain() override {};
59
60 uint64_t maxSize() const override;
61
62 uint64_t minSize() const override;
63
64 uint64_t currentSize() const override;
65
66 uint64_t currentCount() const override;
67
68 int64_t maxObjectSize() const override;
69
70 void getStats(StoreInfoStats &) const override;
71
72 void stat(StoreEntry &) const override; /* output stats to the provided store entry */
73
74 virtual void reference(StoreEntry &) {} /* Reference this object */
75
76 virtual bool dereference(StoreEntry &) { return true; }
77
78 virtual StoreSearch *search();
79};
80
82
83#endif
84
allows testing of methods without having all the other components live
Definition: testStore.h:43
virtual bool dereference(StoreEntry &)
Definition: testStore.h:76
uint64_t maxSize() const override
Definition: testStore.cc:40
void init() override
Definition: testStore.cc:36
uint64_t currentCount() const override
the total number of objects stored right now
Definition: testStore.cc:58
uint64_t currentSize() const override
current size
Definition: testStore.cc:52
int callback() override
called once every main loop iteration; TODO: Move to UFS code.
Definition: testStore.cc:20
virtual StoreEntry * get(const cache_key *)
Definition: testStore.cc:26
int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
Definition: testStore.cc:64
virtual StoreSearch * search()
Definition: testStore.cc:81
virtual void reference(StoreEntry &)
Definition: testStore.h:74
void getStats(StoreInfoStats &) const override
collect statistics
Definition: testStore.cc:70
uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
Definition: testStore.cc:46
void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: testStore.h:58
void stat(StoreEntry &) const override
Definition: testStore.cc:75
High-level store statistics used by mgr:info action. Used inside PODs!
Definition: StoreStats.h:14
CPPUNIT_TEST_SUITE_END()
CPPUNIT_TEST_SUITE(TestStore)
CPPUNIT_TEST(testSetRoot)
CPPUNIT_TEST(testUnsetRoot)
void testMaxSize()
Definition: testStore.cc:121
CPPUNIT_TEST(testSwapMetaTypeClassification)
CPPUNIT_TEST(testMaxSize)
void testSwapMetaTypeClassification()
Definition: testStore.cc:191
CPPUNIT_TEST(testStats)
void testStats()
Definition: testStore.cc:109
void testSetRoot()
Definition: testStore.cc:87
void testUnsetRoot()
Definition: testStore.cc:97
unsigned char cache_key
Store key.
Definition: forward.h:29
RefCount< StoreControllerStub > StoreControllerStubPointer
Definition: testStore.h:81

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors