Skip to content

Commit 8cf1beb

Browse files
committed
Move cache helpers to separate module
1 parent 04aeb98 commit 8cf1beb

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

quixstreams/state/rocksdb/cache.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from dataclasses import dataclass, field
2+
from typing import Optional
3+
4+
5+
@dataclass
6+
class TimestampsCache:
7+
key: bytes
8+
cf_name: str
9+
timestamps: dict[bytes, Optional[int]] = field(default_factory=dict)
10+
11+
12+
@dataclass
13+
class CounterCache:
14+
key: bytes
15+
cf_name: str
16+
counter: Optional[int] = None

quixstreams/state/rocksdb/timestamped.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
)
88
from quixstreams.state.metadata import SEPARATOR
99
from quixstreams.state.recovery import ChangelogProducer
10+
from quixstreams.state.rocksdb.cache import TimestampsCache
1011
from quixstreams.state.rocksdb.metadata import (
1112
LATEST_TIMESTAMP_KEY,
1213
LATEST_TIMESTAMPS_CF_NAME,
1314
)
1415
from quixstreams.state.rocksdb.types import RocksDBOptionsType
15-
from quixstreams.state.rocksdb.windowed.transaction import TimestampsCache
1616
from quixstreams.state.serialization import (
1717
DumpsFunc,
1818
LoadsFunc,

quixstreams/state/rocksdb/windowed/transaction.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import itertools
2-
from dataclasses import dataclass, field
32
from typing import TYPE_CHECKING, Any, Iterable, Optional, cast
43

54
from quixstreams.state.base.transaction import (
@@ -9,6 +8,7 @@
98
)
109
from quixstreams.state.metadata import DEFAULT_PREFIX, SEPARATOR
1110
from quixstreams.state.recovery import ChangelogProducer
11+
from quixstreams.state.rocksdb.cache import CounterCache, TimestampsCache
1212
from quixstreams.state.serialization import (
1313
DumpsFunc,
1414
LoadsFunc,
@@ -41,20 +41,6 @@
4141
from .partition import WindowedRocksDBStorePartition
4242

4343

44-
@dataclass
45-
class TimestampsCache:
46-
key: bytes
47-
cf_name: str
48-
timestamps: dict[bytes, Optional[int]] = field(default_factory=dict)
49-
50-
51-
@dataclass
52-
class CounterCache:
53-
key: bytes
54-
cf_name: str
55-
counter: Optional[int] = None
56-
57-
5844
class WindowedRocksDBPartitionTransaction(PartitionTransaction):
5945
def __init__(
6046
self,

0 commit comments

Comments
 (0)