@@ -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
4254public:
@@ -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