ra_snapshot: Track latest snapshot size in bytes in state#598
Merged
ra_snapshot: Track latest snapshot size in bytes in state#598
Conversation
c4aee36 to
1d26077
Compare
1d26077 to
684660b
Compare
This will be useful to Ra machine implementations to include this value
in their snaphsot decision.
The snapshot module implementation can now return the size of the
snapshot from its `write/4` callback with `{ok, SnapshotSize}` where
`SnapshotSize` is a non-negative integer representing the number of
bytes of the snapshot.
To maintain backward compatibility, returning the historic `ok` value is
accepted. In this case, the snapshot size is set to `undefined`.
Likewise, when a snapshot is recovered, a new optional snapshot module
callback is used, `get_size/1`. If the callback is unimplemented or if
the callback returns an error, the snapshot size is set to `undefined`.
Note that this commit only adds the tracking, not the query API. This
will be added in a follow-up commit.
This will be useful to Ra machine implementations to include this value in their snaphsot decision.
684660b to
75c647b
Compare
kjnilsson
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will be useful to Ra machine implementations to include this value in their snaphsot decision.
The snapshot module implementation can now return the size of the snapshot from its
write/4callback with{ok, SnapshotSize}whereSnapshotSizeis a non-negative integer representing the number of bytes of the snapshot.To maintain backward compatibility, returning the historic
okvalue is accepted. In this case, the snapshot size is set toundefined.Likewise, when a snapshot is recovered, a new optional snapshot module callback is used,
get_size/1. If the callback is unimplemented or if the callback returns an error, the snapshot size is set toundefined.