Skip to content

Commit 1560f5e

Browse files
committed
feat: add cleanup timestamp saving for better performance
1 parent 3c4eb15 commit 1560f5e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/state_machine_api.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use std::time::Duration;
16+
1517
use map_api::MapApi;
1618

1719
use crate::ExpireKey;
@@ -49,6 +51,20 @@ pub trait StateMachineApi<SysData>: Send + Sync {
4951
/// Returns a mutable reference to the map that stores expired key data.
5052
fn expire_map_mut(&mut self) -> &mut Self::ExpireMap;
5153

54+
/// The timestamp since which to start cleaning expired keys.
55+
///
56+
/// The timestamp is the duration since the Unix epoch.
57+
/// Applications should save this timestamp when using storage with tombstones
58+
/// that persist across cleanup rounds.
59+
fn cleanup_start_timestamp(&self) -> Duration;
60+
61+
/// Set the timestamp since which to start cleaning expired keys.
62+
///
63+
/// The timestamp is the duration since the Unix epoch.
64+
/// Applications should save this timestamp when using storage with tombstones
65+
/// that persist across cleanup rounds.
66+
fn set_cleanup_start_timestamp(&mut self, timestamp: Duration);
67+
5268
/// Returns a mutable reference to the system data.
5369
///
5470
/// This method provides read-write access to the system data, which includes

0 commit comments

Comments
 (0)