Skip to content

Synchronize rsmgclient with pymgclient #28

@antaljanosbenjamin

Description

@antaljanosbenjamin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions