Skip to content

Commit 0aae91f

Browse files
committed
Revert "LatestValueCache: Expose keys for which messages have been received (frequenz-floss#425)"
This reverts commit 6f24b25, reversing changes made to 3edcb49. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 6f24b25 commit 0aae91f

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

src/frequenz/channels/_latest_value_cache.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
import asyncio
4646
import typing
47-
from collections.abc import Set
4847

4948
from ._receiver import Receiver
5049

@@ -146,13 +145,6 @@ def unique_id(self) -> str:
146145
"""The unique identifier of this instance."""
147146
return self._unique_id
148147

149-
def keys(self) -> Set[HashableT]:
150-
"""Return the set of keys for which values have been received.
151-
152-
If no key function is provided, this will return an empty set.
153-
"""
154-
return self._latest_value_by_key.keys()
155-
156148
def get(self, key: HashableT | Sentinel = NO_KEY) -> T_co:
157149
"""Return the latest value that has been received.
158150

tests/test_latest_value_cache_integration.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ async def test_latest_value_cache() -> None:
4444

4545
assert cache.get() == 19
4646

47-
assert cache.keys() == set()
48-
4947

5048
@pytest.mark.integration
5149
async def test_latest_value_cache_key() -> None:
@@ -61,8 +59,6 @@ async def test_latest_value_cache_key() -> None:
6159
with pytest.raises(ValueError, match="No value received for key: 0"):
6260
cache.get(0)
6361

64-
assert cache.keys() == set()
65-
6662
await sender.send((5, "a"))
6763
await sender.send((6, "b"))
6864
await sender.send((5, "c"))
@@ -77,8 +73,6 @@ async def test_latest_value_cache_key() -> None:
7773
assert cache.get(5) == (5, "c")
7874
assert cache.get(6) == (6, "b")
7975

80-
assert cache.keys() == {5, 6}
81-
8276
with pytest.raises(ValueError, match="No value received for key: 7"):
8377
cache.get(7)
8478

@@ -98,5 +92,3 @@ async def test_latest_value_cache_key() -> None:
9892
await asyncio.sleep(0)
9993

10094
assert cache.get(6) == (6, "g")
101-
102-
assert cache.keys() == {5, 6, 12}

0 commit comments

Comments
 (0)