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
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,8 @@ delete_local_copy: true

delete_cloud_copy: true

```
```

### Documentation

GRPC related documentation can be found [here](./code/go/0chain.net/blobbercore/blobbergrpc/README.md).
35 changes: 31 additions & 4 deletions code/go/0chain.net/blobbercore/blobbergrpc/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
# GRPC Migration
# GRPC Endpoints

## Development

Modify the '.proto' file in `code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto` and run
`scripts/generate-grpc.sh` to add new api's.

GRPC API is implemented in `code/go/0chain.net/blobbercore/handler/grpc_handler.go`.

## Installation

Install the [protoc](https://grpc.io/docs/protoc-installation/) command line interface.

```
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
```

Run this command to install all the GRPC related binaries required to generate GRPC related files using `protoc` CLI.

Now you can run the script in `scripts/generate-grpc.sh`.

## Plugins

* [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway)
plugin is being used to expose a REST api for grpc incompatible clients.

## Interacting with the api
## Testing

The current grpc implementation supports server reflection in development environment.
You can interact with the api using https://github.com/gusaul/grpcox.

Make sure the server is running on `--deployment_mode 0` to use server reflection.

## Dealing with paths
Refer to - https://developers.google.com/protocol-buffers/docs/reference/go-generated
You can use https://github.com/vektra/mockery to generate mocks for tests.

## Documentation

Basic documentation can be found here - https://grpc.io/docs/languages/go/basics/.

Advanced documentation can be found here - https://github.com/grpc/grpc-go/tree/master/Documentation.