diff --git a/kreya/grpc/com/xtdb/protos/GrpcApi/SubmitTx-request.json b/kreya/grpc/com/xtdb/protos/GrpcApi/SubmitTx-request.json index 5bc2b03..ce308e7 100644 --- a/kreya/grpc/com/xtdb/protos/GrpcApi/SubmitTx-request.json +++ b/kreya/grpc/com/xtdb/protos/GrpcApi/SubmitTx-request.json @@ -2,11 +2,13 @@ "txOps": [ { "put": { + "xtId": "id1", "document": "Via Security" } }, { "put": { + "xtId": "id2", "document": "Rustic Plastic Sausages Graphic Interface incubate" } } diff --git a/resources/service.proto b/resources/service.proto index ebdfd37..4103bd2 100644 --- a/resources/service.proto +++ b/resources/service.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package com.xtdb.protos; + import "transactions.proto"; message Empty { } diff --git a/src/gxtdb/adapters/tx_log.clj b/src/gxtdb/adapters/tx_log.clj new file mode 100644 index 0000000..8f00a38 --- /dev/null +++ b/src/gxtdb/adapters/tx_log.clj @@ -0,0 +1,11 @@ +(ns gxtdb.adapters.tx-log + (:require [gxtdb.utils :as utils])) + +(defn ->tx-log [ops] + (let [transaction (-> ops :transaction-type) + transaction-type (-> transaction keys first)] + (println (str "---" "\n" transaction-type "\n" transaction "\n\n\n")))) + +(defn proto->tx-log [tx-ops] + (println (str "ARROZ" "\n\n\n" tx-ops "\n\n")) + (mapv ->tx-log tx-ops)) diff --git a/src/gxtdb/service.clj b/src/gxtdb/service.clj index 3438780..11775f2 100644 --- a/src/gxtdb/service.clj +++ b/src/gxtdb/service.clj @@ -5,6 +5,7 @@ [ring.util.response :as ring-resp] [gxtdb.adapters.status :as status-adapter] + [gxtdb.adapters.tx-log :as tx-log-adapter] ;; -- XTDB -- [xtdb.api :as xt] @@ -43,7 +44,8 @@ (deftype GrpcAPI [xtdb-node] api/Service - (SubmitTx [_this _request] + (SubmitTx [_this {{:keys [tx-ops]} :grpc-params}] + (let [tx-log (tx-log-adapter/proto->tx-log tx-ops)]) {:status 200 :body {:tx-time "time" :tx-id 3}}) (Status