1a06c2b0c7
* adds proto files for netstate crud * moves netstate grpc client lib into pkg/netstate where grpc netstate service is defined * starts adding grpc client and server tests * moves creation of grpc server into cmd/netstate/main.go, removes pkg/netstate/service.go, adds more client testing * changed all 'Path' and 'Value' fields from strings to bytes, updated tests * changes Get and Delete in proto file to receive 'requests' instead of 'file paths', adds tests for Get, List, and Delete * changes netstate-routes to get 'fileValue' bytes not 'fileInfo' * adds example rpc client in 'examples' and adds more specific debug logs * adds readmes for netstate rpc services and updates netstate-routes
17 lines
835 B
Markdown
17 lines
835 B
Markdown
# gRPC Client + BoltDB Crud Interface
|
|
|
|
This is an example gRPC client which makes CRUD requests (create, read, update, delete) for storing file paths and small values to BoltDB.
|
|
|
|
The gRPC server at `storj.io/storj/cmd/netstate-rpc/server/main.go` needs to be running for this to work.
|
|
|
|
To run the client:
|
|
```
|
|
go run examples/netstate-client/main.go
|
|
```
|
|
You can change the port number with a flag if necessary: `-port=<port-number>`
|
|
|
|
Afterward, you can use [Bolter](https://github.com/hasit/bolter) or a similar BoltDB viewer to make sure your files were changed as expected.
|
|
|
|
If changes are made to `storj.io/storj/protos/netstate/netstate.proto`, the protobuf file will need to be regenerated by running `go generate` inside `protos/netstate`.
|
|
|
|
Tests for this example code can be found in `storj.io/storj/pkg/netstate/client_test.go`. |