]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | /* |
77b1029d | 2 | * Copyright (C) 1996-2020 The Squid Software Foundation and contributors |
187642d0 | 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. | |
528b2c61 | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 47 Store Directory Routines */ |
10 | ||
58373ff8 FC |
11 | #include "squid.h" |
12 | #include "cbdata.h" | |
13 | #include "StoreSearchUFS.h" | |
14 | #include "UFSSwapDir.h" | |
15 | ||
16 | CBDATA_NAMESPACED_CLASS_INIT(Fs::Ufs,StoreSearchUFS); | |
17 | ||
18 | Fs::Ufs::StoreSearchUFS::StoreSearchUFS(RefCount<UFSSwapDir> aSwapDir) : | |
cc8c4af2 AJ |
19 | sd(aSwapDir), |
20 | walker(sd->repl->WalkInit(sd->repl)), | |
21 | cbdata(NULL), | |
22 | current(NULL), | |
23 | _done(false) | |
58373ff8 FC |
24 | {} |
25 | ||
26 | Fs::Ufs::StoreSearchUFS::~StoreSearchUFS() | |
27 | { | |
28 | walker->Done(walker); | |
29 | walker = NULL; | |
30 | } | |
31 | ||
32 | void | |
33 | Fs::Ufs::StoreSearchUFS::next(void (aCallback)(void *cbdata), void *aCallbackArgs) | |
34 | { | |
35 | next(); | |
36 | aCallback(aCallbackArgs); | |
37 | } | |
38 | ||
39 | bool | |
40 | Fs::Ufs::StoreSearchUFS::next() | |
41 | { | |
42 | /* the walker API doesn't make sense. the store entries referred to are already readwrite | |
43 | * from their hash table entries | |
44 | */ | |
45 | ||
46 | if (walker) | |
47 | current = const_cast<StoreEntry *>(walker->Next(walker)); | |
48 | ||
49 | if (current == NULL) | |
50 | _done = true; | |
51 | ||
52 | return current != NULL; | |
53 | } | |
54 | ||
55 | bool | |
56 | Fs::Ufs::StoreSearchUFS::error() const | |
57 | { | |
58 | return false; | |
59 | } | |
60 | ||
61 | bool | |
62 | Fs::Ufs::StoreSearchUFS::isDone() const | |
63 | { | |
64 | return _done; | |
65 | } | |
66 | ||
67 | StoreEntry * | |
68 | Fs::Ufs::StoreSearchUFS::currentItem() | |
69 | { | |
70 | return current; | |
71 | } | |
f53969cc | 72 |