@@ -65,7 +65,6 @@ def get_last(
65
65
self ,
66
66
timestamp : int ,
67
67
prefix : Any ,
68
- cf_name : str = "default" ,
69
68
) -> Optional [Any ]:
70
69
"""Get the latest value for a prefix up to a given timestamp.
71
70
@@ -78,7 +77,6 @@ def get_last(
78
77
79
78
:param timestamp: The upper bound timestamp (inclusive) in milliseconds.
80
79
:param prefix: The key prefix.
81
- :param cf_name: The column family name.
82
80
:return: The deserialized value if found, otherwise None.
83
81
"""
84
82
@@ -91,8 +89,8 @@ def get_last(
91
89
92
90
value : Optional [bytes ] = None
93
91
94
- deletes = self ._update_cache .get_deletes (cf_name = cf_name )
95
- updates = self ._update_cache .get_updates (cf_name = cf_name ).get (prefix , {})
92
+ deletes = self ._update_cache .get_deletes ()
93
+ updates = self ._update_cache .get_updates ().get (prefix , {})
96
94
97
95
cached = sorted (updates .items (), reverse = True )
98
96
for cached_key , cached_value in cached :
@@ -104,7 +102,6 @@ def get_last(
104
102
lower_bound = lower_bound ,
105
103
upper_bound = upper_bound ,
106
104
backwards = True ,
107
- cf_name = cf_name ,
108
105
)
109
106
for stored_key , stored_value in stored :
110
107
if stored_key in deletes :
@@ -126,7 +123,6 @@ def set_for_timestamp(
126
123
value : Any ,
127
124
prefix : Any ,
128
125
retention_ms : int = DAYS_7 ,
129
- cf_name : str = "default" ,
130
126
) -> None :
131
127
"""Set a value for the timestamp.
132
128
@@ -139,18 +135,17 @@ def set_for_timestamp(
139
135
:param timestamp: Timestamp associated with the value in milliseconds.
140
136
:param value: The value to store.
141
137
:param prefix: The key prefix.
142
- :param cf_name: Column family name.
143
138
"""
144
139
prefix = self ._ensure_bytes (prefix )
145
- super ().set (timestamp , value , prefix , cf_name = cf_name )
140
+ super ().set (timestamp , value , prefix )
146
141
min_eligible_timestamp = max (
147
142
self ._get_min_eligible_timestamp (prefix ),
148
143
timestamp - retention_ms ,
149
144
)
150
145
self ._set_min_eligible_timestamp (prefix , min_eligible_timestamp )
151
- self ._expire (prefix = prefix , cf_name = cf_name )
146
+ self ._expire (prefix = prefix )
152
147
153
- def _expire (self , prefix : bytes , cf_name : str = "default" ) -> None :
148
+ def _expire (self , prefix : bytes ) -> None :
154
149
"""
155
150
Delete all entries for a given prefix with timestamps less than the
156
151
provided timestamp.
@@ -159,26 +154,21 @@ def _expire(self, prefix: bytes, cf_name: str = "default") -> None:
159
154
RocksDB store within the current transaction.
160
155
161
156
:param prefix: The key prefix.
162
- :param cf_name: Column family name.
163
157
"""
164
158
165
159
min_eligible_timestamp = self ._get_min_eligible_timestamp (prefix )
166
160
167
161
key = self ._serialize_key (min_eligible_timestamp , prefix )
168
162
169
- cached = self ._update_cache .get_updates (cf_name = cf_name ).get (prefix , {})
163
+ cached = self ._update_cache .get_updates ().get (prefix , {})
170
164
# Cast to list to avoid RuntimeError: dictionary changed size during iteration
171
165
for cached_key in list (cached ):
172
166
if cached_key < key :
173
- self ._update_cache .delete (cached_key , prefix , cf_name = cf_name )
167
+ self ._update_cache .delete (cached_key , prefix )
174
168
175
- stored = self ._partition .iter_items (
176
- lower_bound = prefix ,
177
- upper_bound = key ,
178
- cf_name = cf_name ,
179
- )
169
+ stored = self ._partition .iter_items (lower_bound = prefix , upper_bound = key )
180
170
for stored_key , _ in stored :
181
- self ._update_cache .delete (stored_key , prefix , cf_name = cf_name )
171
+ self ._update_cache .delete (stored_key , prefix )
182
172
183
173
def _ensure_bytes (self , prefix : Any ) -> bytes :
184
174
if isinstance (prefix , bytes ):
0 commit comments