Decay: Take current time as an argument.

This better facilitates testing.
This commit is contained in:
David Goldblatt
2020-03-10 08:52:58 -07:00
committed by David Goldblatt
parent bf55e58e63
commit f77cec311e
3 changed files with 14 additions and 9 deletions

View File

@@ -133,14 +133,14 @@ bool decay_ms_valid(ssize_t decay_ms);
*
* Returns true on error.
*/
bool decay_init(decay_t *decay, ssize_t decay_ms);
bool decay_init(decay_t *decay, nstime_t *cur_time, ssize_t decay_ms);
/*
* Given an already-initialized decay_t, reinitialize it with the given decay
* time. The decay_t must have previously been initialized (and should not then
* be zeroed).
*/
void decay_reinit(decay_t *decay, ssize_t decay_ms);
void decay_reinit(decay_t *decay, nstime_t *cur_time, ssize_t decay_ms);
/* Returns true if the epoch advanced and there are pages to purge. */
bool decay_maybe_advance_epoch(decay_t *decay, nstime_t *new_time,