Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

issue-19/entity-tx: base impl. #34

Merged
merged 4 commits into from
Jun 18, 2023
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fix-clj: cljfmt kibit
fix-rs: rsfmt clippy

proto:
protoc --clojure_out=grpc-client,grpc-server:src --proto_path=resources resources/transactions.proto resources/service.proto
protoc --clojure_out=grpc-client,grpc-server:src --proto_path=resources resources/common.proto resources/transactions.proto resources/entity.proto resources/service.proto

all: proto fix

Expand Down
7 changes: 7 additions & 0 deletions gxtdb-rs/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ impl GrpcApi for ServerMock {
) -> Result<tonic::Response<proto_api::SubmitResponse>, tonic::Status> {
todo!()
}

async fn entity_tx(
&self,
_request: tonic::Request<proto_api::EntityTxRequest>,
) -> Result<tonic::Response<proto_api::EntityTxResponse>, tonic::Status> {
todo!()
}
}

pub async fn client() -> gxtdb_rs::Client {
Expand Down
14 changes: 14 additions & 0 deletions kreya/grpc/com/xtdb/protos/GrpcApi/EntityTx-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"idType": "Keyword",
"entityId": "id1",
"openSnapshot": false,
"txId": {
"none": {}
},
"validTime": {
"none": {}
},
"txTime": {
"none": {}
}
}
12 changes: 12 additions & 0 deletions kreya/grpc/com/xtdb/protos/GrpcApi/EntityTx.krop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"details": {
"methodFqn": "com.xtdb.protos.GrpcApi.EntityTx"
},
"requests": [
{
"location": "EntityTx-request.json"
}
],
"operationType": "unary",
"invokerName": "grpc"
}
5 changes: 1 addition & 4 deletions kreya/grpc/com/xtdb/protos/GrpcApi/SubmitTx-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"document": {"key": "value"}
}
}
],
"txTime": {
"some": "2023-06-12T21:32:44.717-05:00"
}
]
}
14 changes: 14 additions & 0 deletions resources/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@ syntax = "proto3";

package com.xtdb.protos;

enum IdType {
Uuid = 0;
Keyword = 1;
String = 2;
Int = 3;
}

message Empty {}

message OptionInt64 {
oneof value {
Empty none = 1;
int64 some = 2;
}
}

message OptionString {
oneof value {
Empty none = 1;
Expand Down
21 changes: 21 additions & 0 deletions resources/entity.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax = "proto3";

package com.xtdb.protos;
import "common.proto";

message EntityTxResponse {
string xt_id = 1;
string content_hash = 2;
string valid_time = 3;
string tx_time = 4;
int64 tx_id = 5;
}

message EntityTxRequest {
IdType id_type = 1;
string entity_id = 2;
bool open_snapshot = 3;
OptionInt64 tx_id = 4;
OptionDatetime valid_time = 5;
OptionDatetime tx_time = 6;
}
3 changes: 3 additions & 0 deletions resources/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package com.xtdb.protos;

import "transactions.proto";
import "entity.proto";
import "common.proto";


Expand All @@ -20,4 +21,6 @@ service GrpcApi {
rpc Status(Empty) returns (StatusResponse);
rpc SubmitTx(com.xtdb.protos.SubmitRequest)
returns (com.xtdb.protos.SubmitResponse);
rpc EntityTx(com.xtdb.protos.EntityTxRequest)
returns (com.xtdb.protos.EntityTxResponse);
}
9 changes: 0 additions & 9 deletions resources/transactions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ message Transaction {
}
}

enum IdType {
Uuid = 0;
Keyword = 1;
String = 2;
Int = 3;
}



message Put {
IdType id_type = 1;
string xt_id = 2;
Expand Down
Loading