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

Checkpointing done right #2149

Merged
merged 14 commits into from
May 4, 2019
Merged

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented May 1, 2019

This is intended to replace #2147.

template<typename Message>
class Checkpointer {
public:
// A function that reconstructs an object from a checkpoint. It must return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A function that reconstructs an object from a checkpoint as a side effect, I got confused looking for the object in the signature.

Alternatively, templatize on the object and pass it by non-const reference.

Copy link
Member Author

@pleroy pleroy May 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started with templatizing on the object, but it looked silly because it would take the pointer at construction and store it just to pass it back to the callbacks. Incidentally, the current schema would technically make it possible to checkpoint several objects together.

Beefed up the comment.

static Instant infinite_future = Instant() + quantities::Infinity<Time>();
return infinite_future;
} else {
message->MergeFrom(checkpoints_.cbegin()->second);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this have the correct behaviour for repeated fields, since those are appended instead of overwritten? If it does not, there should be a comment warning of that in the header file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

@eggrobin eggrobin added the LGTM label May 3, 2019
@pleroy
Copy link
Member Author

pleroy commented May 4, 2019

retest this please

@pleroy
Copy link
Member Author

pleroy commented May 4, 2019

Verified that both recent and old saves could be loaded.

Sorry, something went wrong.

@pleroy pleroy merged commit 5ae2d17 into mockingbirdnest:master May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants