]> git.ipfire.org Git - thirdparty/squid.git/blame - src/StoreHashIndex.h
Boilerplate: update copyright blurbs on src/
[thirdparty/squid.git] / src / StoreHashIndex.h
CommitLineData
c8f4eac4 1/*
bbc27441 2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
c8f4eac4 3 *
bbc27441
AJ
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.
c8f4eac4 7 */
8
9#ifndef SQUID_STOREHASHINDEX_H
10#define SQUID_STOREHASHINDEX_H
11
12#include "Store.h"
13#include "StoreSearch.h"
14
15/* A summary store that indexs all its children
16 * into a memory hash
17 */
18
19class StoreSearch;
20
21class StoreHashIndex : public Store
22{
23
24public:
25 StoreHashIndex();
26 StoreHashIndex(StoreHashIndex const &); /* to cause link failures */
27 virtual ~StoreHashIndex();
28 virtual int callback();
29 virtual void create();
30
31 virtual StoreEntry * get
26ac0430 32 (const cache_key *);
c8f4eac4 33
34 virtual void get
26ac0430 35 (String const, STOREGETCLIENT, void * cbdata);
c8f4eac4 36
37 virtual void init();
38
39 virtual void sync();
40
12e11a5c 41 virtual uint64_t maxSize() const;
c8f4eac4 42
12e11a5c 43 virtual uint64_t minSize() const;
c8f4eac4 44
39c1e1d9
DK
45 virtual uint64_t currentSize() const;
46
47 virtual uint64_t currentCount() const;
48
af2fda07
DK
49 virtual int64_t maxObjectSize() const;
50
93bc1434 51 virtual void getStats(StoreInfoStats &stats) const;
c8f4eac4 52 virtual void stat(StoreEntry&) const;
53
54 virtual void reference(StoreEntry&);
55
54347cbd 56 virtual bool dereference(StoreEntry&, bool);
c8f4eac4 57
58 virtual void maintain();
59
30abd221 60 virtual StoreSearch *search(String const url, HttpRequest *);
c8f4eac4 61
62private:
63 /* migration logic */
64 StorePointer store(int const x) const;
14911a4e 65 SwapDir &dir(int const idx) const;
c8f4eac4 66};
67
68class StoreHashIndexEntry : public StoreEntry
26ac0430 69 {};
c8f4eac4 70
71class StoreSearchHashIndex : public StoreSearch
72{
73
74public:
75 StoreSearchHashIndex(RefCount<StoreHashIndex> sd);
76 StoreSearchHashIndex(StoreSearchHashIndex const &);
77 virtual ~StoreSearchHashIndex();
78 /* Iterator API - garh, wrong place */
79 /* callback the client when a new StoreEntry is available
26ac0430 80 * or an error occurs
c8f4eac4 81 */
82 virtual void next(void (callback)(void *cbdata), void *cbdata);
83 /* return true if a new StoreEntry is immediately available */
84 virtual bool next();
85 virtual bool error() const;
86 virtual bool isDone() const;
87 virtual StoreEntry *currentItem();
88
89 RefCount<StoreHashIndex> sd;
90
91private:
c8f4eac4 92 void copyBucket();
93 void (*callback)(void *cbdata);
94 void *cbdata;
95 bool _done;
96 int bucket;
81481ec0 97 std::vector<StoreEntry *> entries;
d2bf2f90
AJ
98
99 // keep this last. it plays with private/public
100 CBDATA_CLASS2(StoreSearchHashIndex);
c8f4eac4 101};
102
103#endif /* SQUID_STOREHASHINDEX_H */