storj/cmd/netstate
Bryan White 1ebd66d880 Cleanup & bolt-backed cache (#87)
* wip post-demos cleanup

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Reorganize:

storage
├── common
│   └── common.go `package storage`
├── boltdb
│   └── ...
└── redis
    └── ...

storage
├── common.go `package storage`
├── boltdb
│   └── ...
└── redis
    └── ...

storage
├── common
│   ├── common.go `package storage`
│   └── testing.go `package storage` <--
└── ...

internal
├── app
│   └── cli
├── pkg
│   └── readcloser
└── test
    └── util.go `package test` <--

* remove comment

* add and use goimports

* add test types & fix some lint errors

* better typing

* fixing linter issues/comments

* goimports

* goimports

* more linter fixes; replace panic with NoError assertions in tests

* fix typo/more linter errors

* moar better linter fixes

* even moar better linter fixes

* linter

* add localPort back

* fixing exports, imports, and add comments
2018-06-13 14:22:32 -04:00
..
main.go Cleanup & bolt-backed cache (#87) 2018-06-13 14:22:32 -04:00
README.md Enables netstate service to save pointers (#49) 2018-05-29 22:47:40 -04:00

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 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.