]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 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) : | |
f53969cc SM |
19 | sd(aSwapDir), walker (sd->repl->WalkInit(sd->repl)), |
20 | current (NULL), _done (false) | |
58373ff8 FC |
21 | {} |
22 | ||
23 | Fs::Ufs::StoreSearchUFS::~StoreSearchUFS() | |
24 | { | |
25 | walker->Done(walker); | |
26 | walker = NULL; | |
27 | } | |
28 | ||
29 | void | |
30 | Fs::Ufs::StoreSearchUFS::next(void (aCallback)(void *cbdata), void *aCallbackArgs) | |
31 | { | |
32 | next(); | |
33 | aCallback(aCallbackArgs); | |
34 | } | |
35 | ||
36 | bool | |
37 | Fs::Ufs::StoreSearchUFS::next() | |
38 | { | |
39 | /* the walker API doesn't make sense. the store entries referred to are already readwrite | |
40 | * from their hash table entries | |
41 | */ | |
42 | ||
43 | if (walker) | |
44 | current = const_cast<StoreEntry *>(walker->Next(walker)); | |
45 | ||
46 | if (current == NULL) | |
47 | _done = true; | |
48 | ||
49 | return current != NULL; | |
50 | } | |
51 | ||
52 | bool | |
53 | Fs::Ufs::StoreSearchUFS::error() const | |
54 | { | |
55 | return false; | |
56 | } | |
57 | ||
58 | bool | |
59 | Fs::Ufs::StoreSearchUFS::isDone() const | |
60 | { | |
61 | return _done; | |
62 | } | |
63 | ||
64 | StoreEntry * | |
65 | Fs::Ufs::StoreSearchUFS::currentItem() | |
66 | { | |
67 | return current; | |
68 | } | |
f53969cc | 69 |