-
Notifications
You must be signed in to change notification settings - Fork 20
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
Refactor gets #154
Refactor gets #154
Conversation
I see where you're coming from. I wonder if there should also be a Anyway since this doesn't actually remove the existing function and just renames it + adds additional ones, I'm fine with it. I'd have to play around with it to get a feel for it anyway. |
Mmm interesting... Did you find yourself needing that function at some point? |
Yeah I just think the standard use case is only caring about the oldest delete because that's what you would treat as the "canonical" timestamp and delete author. Having multiple deletes that are all meaningful seems like an edge use case. It also feels weird to me that you're including an opinionated way to define the "latest" update, while not also providing an opinionated way to define the "latest" delete -- either have both or neither. |
Hum my reasoning was performance: not having an opinionated get_latest would hurt performance:
I actually feel that this default will need to be changed or at least constrained by most applications, but it's a good starting template. What I mean is that However, in the case of delete the unopinionated call is just as performant as the opinionated one (a single get_details), and I defaulted to returning all the available information without sacrificing on performance. I see what you mean in that having a vector of deletes be relevant is an edge case. I'm thinking about partition situations, where you might as well display "it was deleted by these two agents", or race conditions... What do you think? |
@ThetaSinner @mattyg I'd like to get this and a couple other PRs merged as other work I'm doing depends on them. Could I get a review / go ahead? |
I'm definitely in favor of having an opinionated get_latest for both updates and deletes -- not just for performance but also for dev ergonomics. For ergonomics its valuable to have coherent consistent functions.
Except that in the typical case you then have to filter the deletes on the front-end.
But you're not returning the updates from the get_details, right? That's because you're also trying to make a meaningful useful, constrained function that gets exposed to the dev.
IMO it is the atypical case where redundant deletes is meaningful information to display in the the app. In a typical case, all I would care about is that the information has been deleted by someone with authority to do so at a timestamp. I'm in favor of renaming |
Yeap! Your proposal makes perfect sense @mattyg , and it aligns with the way that updates work. So I'll make that change and then we can merge this. Thanks for your feedback. |
@ThetaSinner this is ready to be merged AFAICT. Can I get get a review? Also, what's the policy on updating the holochain-0.x branches? I only need this to be included in the holochain-0.2 one, and maybe we don't want to backport it to 0.1 since it'd be a breaking change to people with already scaffolded apps? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Great, can I merge it then @ThetaSinner ? |
Yes please :) and for the back-porting question. This is targeting the right branch for now. It should just be back-ported to |
Amazing, thanks! One less to go. |
Summary of changes:
syn
andpretty-please
dependencies, this is needed to handle the new rustlet Some(_) = my_option else {};
statements.get_entry_type_name
getters:get_entry_type_name(action_hash: ActionHash) -> ExternResult<Option<Record>>
that:get_all_updates
getter, so the UI cannot show a list of updatesget_latest_entry_type_name(action_hash: ActionHash) -> ExternResult<Option<Record>>
: gets the latest update for the entry, returns the entry even if it's deletedget_all_entry_type_name_revisions(action_hash: ActionHash) -> ExternResult<Vec<Record>>
: gets the list of updates for the entry, returns them even if it's deletedget_original_entry_type_name(action_hash: ActionHash) -> ExternResult<Option<Record>>
: gets the create record for the entry, returns the entry even if it's deletedget_entry_type_name(action_hash: ActionHash) -> ExternResult<Option<Record>>
: gets the create record for the entry, returns the entry even if it's deletedget_deletes_for_entry_type(action_hash: ActionHash) -> ExternResult<Vec<SignedActionHash>>
: returns the array ofDelete
actions for the entry, allowing the UI to display information like "it was deleted 4 minutes ago", that was previously not accessible