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

CNS-368: fixation: improve API for GetEntry,FindEntry,PutEntry #403

Merged
merged 2 commits into from
Apr 10, 2023

Conversation

orenl-lava
Copy link
Contributor

Change GetEntry,FindEntry to not return an error, use MustUnmarshal() instead of Unmarshal(). Change PutEntry to not return anything and not fill the entry whose refcount is being dropped (caller must already have it).

Previously they returned an error if the Ummarshal of the entry data failed. However that was bad for two reasons: first, such a failure would indicate a severe logical bug because the very same data must have been marshaled and saved before - hence it must be either corrupted or a new lava version now expects some different format (either way it's a bug). Second, callers do not have a way to rectify such errors, they just treat it as "not found", making it useless.

Change GetEntry,FindEntry to not return an error, use MustUnmarshal() instead
of Unmarshal(). Change PutEntry to not return anything and not fill the entry
whose refcount is being dropped (caller must already have it).

Previously they returned an error if the Ummarshal of the entry data failed.
However that was bad for two reasons: first, such a failure would indicate a
severe logical bug because the very same data must have been marshaled and
saved before - hence it must be either corrupted or a new lava version now
expects some different format (either way it's a bug). Second, callers do not
have a way to rectify such errors, they just treat it as "not found", making it
useless.

Signed-off-by: Oren Laadan <orenl@lavanet.xyz>
@orenl-lava orenl-lava requested review from Yaroms and oren-lava April 8, 2023 13:13
@orenl-lava orenl-lava changed the title CNS-386: fixation: improve API for GetEntry,FindEntry,PutEntry CNS-368: fixation: improve API for GetEntry,FindEntry,PutEntry Apr 8, 2023
common/fixation_entry.go Show resolved Hide resolved
common/fixation_entry.go Outdated Show resolved Hide resolved
common/fixation_entry.go Show resolved Hide resolved
common/fixation_entry.go Show resolved Hide resolved
x/plans/keeper/plan.go Show resolved Hide resolved
@Yaroms Yaroms requested a review from omerlavanet April 9, 2023 13:22
@Yaroms Yaroms merged commit f22c5c7 into main Apr 10, 2023
@Yaroms Yaroms deleted the CNS-368-fixation-store-improve-api branch April 10, 2023 16:27
@orenl-lava orenl-lava restored the CNS-368-fixation-store-improve-api branch April 12, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants