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

Undo manager transactions #489

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Conversation

Horusiath
Copy link
Collaborator

This PR applies several changes:

  1. UndoManager undo/redo methods are now split to resemble new async capabilities of document store:
    • try_undo/try_redo will try to obtain underlying document store transaction and return error on failure.
    • undo_blocking/redo_blocking will obtain transactions, waiting by blocking the thread if necessary.
    • undo/redo now returns futures that will obtain transactions asynchronously.
  2. yundo_manager_can_undo and yundo_manager_can_redo are now replaced by yundo_manager_undo_stack_len and yundo_manager_redo_stack_len.

@Horusiath Horusiath merged commit ae55773 into y-crdt:main Aug 27, 2024
8 checks passed
/// a read-only transaction itself. If transaction couldn't be acquired (because another
/// read-write transaction is in progress), it will hold current thread until, acquisition is
/// available.
pub fn clear(&mut self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there is no try_clear(), as you did for other methods?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I'll need to add that in subsequent release. As of now, it will block current thread but only if there's a pending read-write transaction (since clear only requires a readonly access.

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.

2 participants