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

Implement Transactions and Atomic Reads in Zookeeper Async Rust Client #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MaximFischuk
Copy link

This PR introduces the implementation of transactions and atomic reads. The primary objective is to enable multiple operations to execute atomically, ensuring data consistency and integrity. Additionally, atomic reads have been added to allow for efficient and consistent read operations.

Changes:

  1. Transaction Support:
  • Implemented the Transaction builder to facilitate the creation of transactional operations.
  • Added support for the following transactional operations:
    • Create
    • Create2
    • CreateTtl
    • SetData
    • Delete
    • Check (checking the existence and version of a znode)
  1. Atomic Reads:
    • Implemented the Read builder to enable atomic read operations.
    • Added support for the following read operations:
      • GetData
      • GetChildren
  2. ZooKeeper Client Enhancements:
    • Added functions to the ZooKeeper struct for easily creating the Transaction and Read builders:
      pub fn transaction(&self) -> Transaction;
      pub fn read(&self) -> Read;
  3. Additional Changes:
    • Introduced a new function to the ZooKeeper client:
      pub async fn get_all_children_number(&self, path: &str) -> ZkResult<i32>
    • This function returns the number of children of the node at the given path.
    • This operation returns the number of children recursively. It means the following znode tree has 6 children by path /test
        /test
        /test/child1
        /test/child2/child21
        /test/child3/child31/child311
    

Testing:

  • Added unit tests to verify the functionality of transactional operations.
  • Added unit tests for atomic read operations.
  • Included test cases for the get_all_children_number function.
  • Ensured all existing tests pass without issues.

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.

1 participant