storj/examples/pointerdb-client
Kaloyan Raev 99640225fd
Refactor Path type (#522)
The old paths.Path type is now replaced with the new storj.Path.

storj.Path is simply an alias to the built-in string type. As such it can be used just as any string, which simplifies a lot working with paths. No more conversions paths.New and path.String().

As an alias storj.Path does not define any methods. However, any functions applying to strings (like those from the strings package) gracefully apply to storj.Path too. In addition we have a few more functions defined:

    storj.SplitPath
    storj.JoinPaths
    encryption.EncryptPath
    encryption.DecryptPath
    encryption.DerivePathKey
    encryption.DeriveContentKey

All code in master is migrated to the new storj.Path type.

The Path example is also updated and is good for reference: /pkg/encryption/examples_test.go

This PR also resolve a nonce misuse issue in path encryption: https://storjlabs.atlassian.net/browse/V3-545
2018-10-25 23:28:16 +03:00
..
main.go Refactor Path type (#522) 2018-10-25 23:28:16 +03:00
README.md Flatten proto definitions into a single package (#360) 2018-09-18 07:39:06 +03:00

gRPC Client + BoltDB Crud Interface

This is an example gRPC client which makes CRUD requests (create, read, update, delete) for storing pointers at given paths in BoltDB.

The gRPC server at storj.io/storj/cmd/pointerdb/main.go needs to be running for this to work.

To run the client:

go run examples/pointerdb-client/main.go

You can change the port number with a flag if necessary: -port=<port-number>

Afterward, you can use Bolter or a similar BoltDB viewer to make sure your pointer entries were changed as expected.

If changes are made to storj.io/storj/pkg/pb/pointerdb.proto, the protobuf file will need to be regenerated by running go generate inside pkg/pb.

Tests for this example code can be found in storj.io/storj/pkg/pointerdb/client_test.go.