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

Synchronize rsmgclient with pymgclient #28

Open
antaljanosbenjamin opened this issue Jul 16, 2021 · 0 comments
Open

Synchronize rsmgclient with pymgclient #28

antaljanosbenjamin opened this issue Jul 16, 2021 · 0 comments

Comments

@antaljanosbenjamin
Copy link
Contributor

As we have multiple clients (pymgclient, rsmgclient, the nodejs client) it would be nice if they were been implemented in the same way. I think making a C library on top of mgclient is not useful, because of the various differences in the different languages the API and wrapping can be complicated. Therefore I propose to use the same state machine logic for all clients. I think the biggest difference between pymgclient and rsmgclient currently is how the transactions are handled:

  • for pymgclient there are different states for READY and IN_TRANSACTION
  • for rsmgclient there is a bool flag that indicates whether the connection is in a transaction or not

The smaller differences are:

  • in pymgclient in most (if not every) function that changes the state of the connection documents the preconditions (the state and value of some flags, i.e.: autocommit) with asserts. For rsmgclient I think this is not that consistent. Also, the these checks are using blacklisting instead of white listing.
  • minor differences in naming: Connection::pull_all also fetches the results (pull -> tell the server to prepare some results, fetch -> get the results of a previous pull)
  • in pymgclient there is different cursor and connection class, while in rsmgclient there is only a connection. I think this is fine and no change is required because of this.
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

No branches or pull requests

1 participant