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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors