Skip to content

Commit a5af1fe

Browse files
committed
use using is_transparent = void
1 parent 946a2cb commit a5af1fe

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ydb/core/tablet_flat/shared_cache_s3fifo.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,27 @@ class TS3FIFOGhostPageQueue {
2828
};
2929

3030
struct TGhostPageHash {
31+
using is_transparent = void;
32+
3133
inline size_t operator()(const TGhostPage* ghost) const {
3234
return ghost->Key.GetHash();
3335
}
36+
37+
inline size_t operator()(const TPageKey& key) const {
38+
return key.GetHash();
39+
}
3440
};
3541

3642
struct TGhostPageEqual {
43+
using is_transparent = void;
44+
3745
inline bool operator()(const TGhostPage* left, const TGhostPage* right) const {
3846
return left->Key == right->Key;
3947
}
48+
49+
inline bool operator()(const TGhostPage* left, const TPageKey& right) const {
50+
return left->Key == right;
51+
}
4052
};
4153

4254
public:
@@ -63,8 +75,7 @@ class TS3FIFOGhostPageQueue {
6375
}
6476

6577
bool Erase(const TPageKey& key, ui64 size) {
66-
TGhostPage key_(key, size);
67-
if (auto it = GhostsSet.find(&key_); it != GhostsSet.end()) {
78+
if (auto it = GhostsSet.find(key); it != GhostsSet.end()) {
6879
TGhostPage* ghost = *it;
6980
Y_DEBUG_ABORT_UNLESS(ghost->Size == size);
7081
Y_ABORT_UNLESS(Size >= ghost->Size);
@@ -116,6 +127,7 @@ class TS3FIFOGhostPageQueue {
116127

117128
ui64 Limit;
118129
ui64 Size = 0;
130+
// TODO: store ghost withing PageMap
119131
THashSet<TGhostPage*, TGhostPageHash, TGhostPageEqual> GhostsSet;
120132
TDeque<TGhostPage> GhostsQueue;
121133
};

0 commit comments

Comments
 (0)