-
Notifications
You must be signed in to change notification settings - Fork 37
Architecture Refactor #302
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
Merged
haikalpribadi
merged 29 commits into
typedb:master
from
haikalpribadi:architecture-refactor
Mar 17, 2021
Merged
Architecture Refactor #302
haikalpribadi
merged 29 commits into
typedb:master
from
haikalpribadi:architecture-refactor
Mar 17, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
haikalpribadi
added a commit
to typedb/typedb-protocol
that referenced
this pull request
Mar 15, 2021
## What is the goal of this PR? The previous definition of Grakn RPC protocol did not differentiate the fact that, for the Transaction Bidirectional Stream, some server responses are complete responses for their associated queries, and others are a partial list of a response which are streamed consecutively to make up a full response incrementally. This makes the protocol not explicitly clear to the developer implementing Grakn clients, without having the internal knowledge of how Grakn server responses are designed. We have now refined the Transaction Bidirectional Stream protocol, to express the server behaviour more explicitly. The Transaction Bidirectional Stream now sends "client" messages and receives back "server" messages. "Server" messages are defined to either be a complete response or a partial response. Additionally, we have refined the variable names for some other message definitions. This PR is followed by typedb/typedb-driver#302 in client-java, and another one in Grakn Core (to be created).
lolski
approved these changes
Mar 15, 2021
alexjpwalker
requested changes
Mar 15, 2021
alexjpwalker
approved these changes
Mar 15, 2021
This was referenced Mar 18, 2021
alexjpwalker
pushed a commit
to typedb/typedb-driver-python
that referenced
this pull request
Mar 26, 2021
## What is the goal of this PR? We have refactored Client Python considerably to come up with an architecture that is easy to understand, easy to extend, and easy to replicate in other languages that wish to implement a Grakn Client. This is a **breaking change**. The updated APIs are: #### Create a Grakn Core client ```py client = Grakn.core_client(address="localhost:1729") ``` #### Create a Grakn Cluster client ```py client = Grakn.cluster_client(addresses=["127.0.0.1:11729:11730", "127.0.0.1:21729:21730", "127.0.0.1:31729:31730"]) ``` #### Open a schema-write transaction ```py with session = client.session(GraknSession.Type.SCHEMA): with transaction = session.transaction(GraknTransaction.Type.WRITE): ``` #### Retrieve answer of Graql Match Aggregate query ```py count = tx.query().match_aggregate(query).get() ``` For full details of this rework, please see typedb/typedb-driver#302 . ## What are the changes implemented in this PR? New client architecture
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the goal of this PR?
Over time, Client Java has been extended considerably to implement various features and optimisations. It has lead the architecture to a complex codebase which is not so easy to follow and replicate in other languages. We have now refactored Client Java considerably to come up with an architecture that is easy to understand, easy to extend, and easy to replicate in other languages that wish to implement a Grakn Client.
//stream
.The diagram below describes the new architecture of client-java, which should be able to be replicated across every other language implementation of Grakn Clients.