Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions GraknClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public GraknClient(String address, String username, String password) {
.usePlaintext().build();
this.username = username;
this.password = password;
keyspaces = new Keyspaces(channel);
keyspaces = new Keyspaces(channel, this.username, this.password);
}

public GraknClient overrideChannel(ManagedChannel channel) {
Expand Down Expand Up @@ -557,20 +557,24 @@ protected final T computeNext() {
*/

public static final class Keyspaces {
private String username;
private String password;

private KeyspaceServiceBlockingStub keyspaceBlockingStub;

public Keyspaces(ManagedChannel channel) {
public Keyspaces(ManagedChannel channel, String username, String password) {
keyspaceBlockingStub = KeyspaceServiceGrpc.newBlockingStub(channel);
this.username = username;
this.password = password;
}

public void delete(String name) {
KeyspaceProto.Keyspace.Delete.Req request = RequestBuilder.Keyspace.delete(name);
KeyspaceProto.Keyspace.Delete.Req request = RequestBuilder.Keyspace.delete(name, this.username, this.password);
keyspaceBlockingStub.delete(request);
}

public List<String> retrieve() {
KeyspaceProto.Keyspace.Retrieve.Req request = RequestBuilder.Keyspace.retrieve();
KeyspaceProto.Keyspace.Retrieve.Req request = RequestBuilder.Keyspace.retrieve(this.username, this.password);
return ImmutableList.copyOf(keyspaceBlockingStub.retrieve(request).getNamesList().iterator());
}
}
Expand Down
4 changes: 2 additions & 2 deletions dependencies/graknlabs/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ def graknlabs_protocol():
git_repository(
name = "graknlabs_protocol",
remote = "https://github.com/graknlabs/protocol",
commit = "dbbea5ae6870dc0624658091c221fe9fc292bad1", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_protocol
)
commit = "887409713c38deeebbdae01fa00946097887d20c", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_protocol
)
22 changes: 18 additions & 4 deletions rpc/RequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,26 @@ static ConceptProto.AttributeType.DATA_TYPE dataType(AttributeType.DataType<?> d
*/
public static class Keyspace {

public static KeyspaceProto.Keyspace.Delete.Req delete(String name) {
return KeyspaceProto.Keyspace.Delete.Req.newBuilder().setName(name).build();
public static KeyspaceProto.Keyspace.Delete.Req delete(String name, String username, String password) {
KeyspaceProto.Keyspace.Delete.Req.Builder builder = KeyspaceProto.Keyspace.Delete.Req.newBuilder();
if (username != null) {
builder.setUsername(username);
}
if (password != null) {
builder.setPassword(password);
}
return builder.setName(name).build();
}

public static KeyspaceProto.Keyspace.Retrieve.Req retrieve() {
return KeyspaceProto.Keyspace.Retrieve.Req.newBuilder().build();
public static KeyspaceProto.Keyspace.Retrieve.Req retrieve(String username, String password) {
KeyspaceProto.Keyspace.Retrieve.Req.Builder builder = KeyspaceProto.Keyspace.Retrieve.Req.newBuilder();
if (username != null) {
builder.setUsername(username);
}
if (password != null) {
builder.setPassword(password);
}
return builder.build();
}
}
}