Commit 25668e43 authored by Konstantin Munichev's avatar Konstantin Munichev Committed by Lluis Gifre Renom
Browse files

Update readme file for DLT gateway service

parent 0c0a24c1
Loading
Loading
Loading
Loading
+11 −20
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 duplication of the object or source code - either totally or in
 part - is strictly prohibited.

          Copyright (c) 2021 NEC Laboratories Europe GmbH
          Copyright (c) 2022 NEC Laboratories Europe GmbH
          All Rights Reserved.

 Authors: Konstantin Munichev <konstantin.munichev@neclab.eu>
@@ -42,7 +42,7 @@
## General information
The DLT module is used to provide access to the underlying Fabric deployment. It allows clients
to add, retrieve, modify and delete blockchain-backed data, essentially working as a key-value
database. External clients should use REST API to communicate with this service, its detailed
database. External clients should use gRPC API to communicate with this service, its detailed
description available below.

## Code structure
@@ -59,26 +59,17 @@ CRUD interface.
Other files contain auxiliary code for `FabricConnector` which allows it to register/enroll
users and to obtain smart contract instances.

### HTTP package
Contains server side HTTP handler. It accepts requests from the outside and performs the
requested operation. For the detailed description see API description section.
### Grpc package
Contains server side gRPC handler. It accepts requests from the outside and performs the
requested operation. For the more detailed description see Proto package description right below.

### Proto package
The proto package contains `Config.proto` file which contains messages for REST API. The most
important ones are `DltConfig` (it defines the whole DLT configuration) and `DltRecord` which
represents data to store in the blockchain.
The proto package contains `dlt.proto` file which defines gRPC service `DltService` API and messages
it uses. There are 3 main functions: `RecordToDlt` which allows to create/modify/delete data,
`GetFromDlt` which returns already written data and `SubscribeToDlt` which allows clients subscribe
for future create/modify/delete events with provided filters.
Other proto files don't play any significant role and could be safely ignored by end users.

### Client example
This code is not necessary to the service, but it could be used to test the service. It contains
a sample REST client which connects the service and perform all the CRUD operations. 

## REST API description
| Method | URL | Input | Response code | Output |
| --- | ----------- | --- | --- | --- |
| POST | /dlt/configure | Configuration object | 201 or 400 | Status value | 
| GET | /dlt/configure | - | 200 or 404 | Configuration object |
| POST | /dlt/record | Record object | 200, 201, 400 or 404 | Status value |
| GET | /dlt/record | Record id | 200 or 404 | Record object |

Record and configuration object are defined in `proto` package.
a sample gRPC client which connects the service and perform all the CRUD operations.