Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink valid_since() and forget_before() API #38

Closed
elidupree opened this issue Aug 30, 2017 · 3 comments
Closed

Rethink valid_since() and forget_before() API #38

elidupree opened this issue Aug 30, 2017 · 3 comments

Comments

@elidupree
Copy link
Owner

When I created the valid_since() concept, forget_before() didn't exist, and "when can snapshots be taken?" was the same as "when can fiat events be modified?". Now, simple_flat defaults to retaining enough data to take old snapshots, but can't insert old fiat events.

forget_before() is designed to allow memory to be freed – after you call forget_before(), you can't do anything before that time (except refer to snapshots you already took), but all TimeSteward implementors retain the ability to take new snapshots in all cases EXCEPT where you call forget_before(). Currently, valid_since() only determines when you're allowed to create fiat events, but its name isn't quite right for that.

It seems inconsistent that TimeSteward implementors are required to report valid_since() but isn't required to report the most recent time it has forgotten-before.

@elidupree
Copy link
Owner Author

I previously used the term settled for times when the user promised to submit no more fiat events – that was specifically for knowing when to compare checksums, but it could be the general term as well. So then we could be looking at

fn settle_before (&self, Time);
fn settled_before (&self)->Time;
fn forget_before (&self, ExtendedTime);
fn forgotten_before (&self)->ExtendedTime;

or maybe

fn settle_before (&self, Time);
fn earliest_unsettled_time (&self)->Time;
fn forget_before (&self, ExtendedTime);
fn earliest_remembered_time (&self)->ExtendedTime;

@elidupree
Copy link
Owner Author

Further complication: updated_until_before() could also be related to this. Internal code might want a way to refer to times that are not only settled from a caller perspective, but also no longer being mutated internally, which I think is generally equivalent to min(settled_before, updated_until_before)

@elidupree
Copy link
Owner Author

The word "freeze" is sometimes used for when data that used to be mutable is made immutable. That seems like a fitting concept for this, and clearer than "settle". Thus:

fn freeze_before(&self, Time);
fn earliest_mutable_time(&self)->Option<Time>;
fn forget_before(&self, Time);
fn earliest_remembered_time(&self)->Option<Time>;
fn latest_time_ready_for_snapshot(&self)->Option<Time>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant