Add a comment

This commit is contained in:
kssenii 2023-08-11 18:05:03 +02:00
parent 0f8e5b11f7
commit aa7136c276

View File

@ -355,6 +355,11 @@ public:
return; return;
inserted = keys.insert(key).second; inserted = keys.insert(key).second;
} }
/// There is an invariant that key cannot be submitted for removal if it is already in removal queue.
/// Because
/// 1) when submit key to removal it aquires state REMOVING and we submit key for removal only if it has ACITVE state.
/// 2) if a key is added to cache and it was found in removal queue - it will be removed from the queue and get state ACTIVE.
/// and both these actions are synchronized by the same KeyGuard.
chassert(inserted); chassert(inserted);
if (inserted) if (inserted)
{ {