6723064bfb
* adds pointer to netstate proto file * generated updated netstate proto * changes boltdb netstate to save pointers as values * updates netstate Put to save Pointers, updates client example to put a pointer, adds grpc status errors, updates tests, changes boltdb 'File' struct to 'PointerEntry' * updates netstate client example and client test to save pointers, updates netstate List and Delete * begins adding netstate-http tests * removes netstate http service * re-adds netstate auth * updates boltdb netstate test * changes encrypted_unencrypted_size from int64 to bytes in netstate proto * updates READMEs
32 lines
1.3 KiB
Markdown
32 lines
1.3 KiB
Markdown
# gRPC Server + BoltDB Crud Interface
|
|
|
|
This is a gRPC server which handles CRUD (create, read, update, delete) requests for storing pointers at given paths in BoltDB.
|
|
An example Put Request to store a path and pointer would look like this:
|
|
```
|
|
pr := proto.PutRequest{
|
|
Path: []byte("here's/a/pointer/path"),
|
|
Pointer: &proto.Pointer{
|
|
Type: proto.Pointer_INLINE,
|
|
Encryption: &proto.EncryptionScheme{
|
|
EncryptedEncryptionKey: []byte("key"),
|
|
EncryptedStartingNonce: []byte("nonce"),
|
|
},
|
|
InlineSegment: []byte("littledata"),
|
|
},
|
|
}
|
|
```
|
|
|
|
To run the server:
|
|
```
|
|
go run cmd/netstate/main.go
|
|
```
|
|
You can also run using these flags: `-port=<port-number> -prod=<bool> -db=<db-name>`
|
|
|
|
You can then write a client program using the client library to access the Put, Get, List, and Delete methods to create and interact with pointer entries stored in BoltDB.
|
|
An example program utilizing these functions can be found at `storj.io/storj/examples/netstate-client/main.go`.
|
|
|
|
Afterward, you can also 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`.
|
|
|