Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit 56f34f4

Browse files
committed
Implement missing request builder implementation
1 parent 9f1d0fc commit 56f34f4

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

dependencies/vaticle/artifacts.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ def vaticle_typedb_cluster_artifacts():
3939
artifact_name = "typedb-cluster-all-{platform}-{version}.{ext}",
4040
tag_source = deployment_private["artifact.release"],
4141
commit_source = deployment_private["artifact.snapshot"],
42-
commit = "5a423f70c416d52f49ba541fe6b10b0ff2c89602"
42+
commit = "f6d9eae58c83c165d932c0433a3a0d858e206fab"
4343
)

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424

2525
## Configuration options
2626

27-
2827
# Allow importing of snapshots
2928
--extra-index-url https://repo.vaticle.com/repository/pypi-snapshot/simple
3029

3130

3231
## Dependencies
3332

3433
# IMPORTANT: Any changes to these dependencies should be copied to requirements_dev.txt.
35-
typedb-protocol==2.4.0
34+
typedb-protocol==0.0.0-ec89440dadb449f223ad2c925b238aad06b80c81
3635
grpcio==1.38.0
3736
protobuf==3.15.5

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
## Dependencies
3232

33-
typedb-protocol==2.4.0
33+
typedb-protocol==0.0.0-ec89440dadb449f223ad2c925b238aad06b80c81
3434
grpcio==1.38.0
3535
protobuf==3.15.5
3636

typedb/common/rpc/request_builder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ def cluster_user_password_req(username: str, password: str):
111111
req.password = password
112112
return req
113113

114+
def cluster_user_token_req(username: str):
115+
req = cluster_user_proto.ClusterUser.Token.Req()
116+
req.username = username
117+
return req
118+
114119
def cluster_user_delete_req(username: str):
115120
req = cluster_user_proto.ClusterUser.Delete.Req()
116121
req.username = username

typedb/connection/cluster/stub.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from typedb.api.connection.credential import TypeDBCredential
3535
from typedb.common.exception import CLUSTER_TOKEN_CREDENTIAL_INVALID, TypeDBClientException, UNABLE_TO_CONNECT
36+
from typedb.common.rpc.request_builder import cluster_user_token_req
3637
from typedb.common.rpc.stub import TypeDBStub
3738

3839
T = TypeVar('T')
@@ -48,7 +49,7 @@ def __init__(self, channel: Channel, credential: TypeDBCredential):
4849
self._cluster_stub = cluster_service_proto.TypeDBClusterStub(channel)
4950
self._token = None
5051
try:
51-
self._token = self._cluster_stub.user_token_renew(self._credential.username())
52+
self._token = self._cluster_stub.user_token(cluster_user_token_req(self._credential.username()))
5253
except RpcError as e:
5354
e2 = TypeDBClientException.of_rpc(e)
5455
if e2.error_message is not None and e2.error_message is not UNABLE_TO_CONNECT:
@@ -120,7 +121,7 @@ def may_renew_token(self, function: Callable[[], T]) -> T:
120121
except TypeDBClientException as e:
121122
if e.error_message is not None and e.error_message is CLUSTER_TOKEN_CREDENTIAL_INVALID:
122123
self._token = None
123-
res = self._cluster_stub.user_token_renew(self._credential.username())
124+
res = self._cluster_stub.user_token(cluster_user_token_req(self._credential.username()))
124125
self._token = res.token
125126
try:
126127
return self.resilient_call(function)

0 commit comments

Comments
 (0)