storj/protos/netstate/netstate.proto
Natalie Villasana 80727ae90b adds netstate pagination (#95)
* adds netstate rpc server pagination, mocks pagination in test/util.go

* updates ns client example, combines ns client and server test to netstate_test, adds pagination to bolt client

* better organizes netstate test calls

* wip breaking netstate test into smaller tests

* wip modularizing netstate tests

* adds some test panics

* wip netstate test attempts

* testing bug in netstate TestDeleteAuth

* wip fixes global variable problem, still issues with list

* wip fixes get request params and args

* fixes bug in path when using MakePointers helper fn

* updates mockdb list func, adds test, changes Limit to int

* fixes merge conflicts

* fixes broken tests from merge

* remove unnecessary PointerEntry struct

* removes error when Get returns nil value from boltdb

* breaks boltdb client tests into smaller tests

* renames AssertNoErr test helper to HandleErr

* adds StartingKey and Limit parameters to redis list func, adds beginning of redis tests

* adds helper func for mockdb List function

* if no starting key provided for netstate List, the first value in storage will be used

* adds basic pagination for redis List function, adds tests

* adds list limit to call in overlay/server.go

* streamlines/fixes some nits from review

* removes use of obsolete EncryptedUnencryptedSize

* uses MockKeyValueStore instead of redis instance in redis client test

* changes test to expect nil returned for getting missing key

* remove error from `KeyValueStore#Get`

* fix bolt test

* Merge pull request #1 from bryanchriswhite/nat-pagination

remove error from `KeyValueStore#Get`

* adds Get returning error back to KeyValueStore interface and affected clients

* trying to appease travis: returns errors in Get calls in overlay/cache and cache_test

* handles redis get error when no key found
2018-06-29 16:06:25 -04:00

119 lines
2.9 KiB
Protocol Buffer

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
syntax = "proto3";
package netstate;
import "google/protobuf/timestamp.proto";
// NetState defines the interface for interacting with the network state persistence layer
service NetState {
// Put formats and hands off a file path to be saved to boltdb
rpc Put(PutRequest) returns (PutResponse);
// Get formats and hands off a file path to get a small value from boltdb
rpc Get(GetRequest) returns (GetResponse);
// List calls the bolt client's List function and returns all file paths
rpc List(ListRequest) returns (ListResponse);
// Delete formats and hands off a file path to delete from boltdb
rpc Delete(DeleteRequest) returns (DeleteResponse);
}
message RedundancyScheme {
enum SchemeType {
RS = 0;
}
SchemeType type = 1;
// these values apply to RS encoding
int64 min_req = 2; // minimum required for reconstruction
int64 total = 3; // total amount of pieces we generated
int64 repair_threshold = 4; // amount of pieces we need to drop to before triggering repair
int64 success_threshold = 5; // amount of pieces we need to store to call it a success
}
message EncryptionScheme {
enum EncryptionType {
AESGCM = 0;
SECRETBOX = 1;
// only allow authenticated encryption schemes
}
EncryptionType type = 1;
bytes encrypted_encryption_key = 2;
bytes encrypted_starting_nonce = 3;
}
message RemotePiece {
int64 piece_num = 1;
string node_id = 2;
}
message RemoteSegment {
RedundancyScheme redundancy = 1;
string piece_id = 2;
repeated RemotePiece remote_pieces = 3;
bytes merkle_root = 4; // root hash of the hashes of all of these pieces
}
message Pointer {
enum DataType {
INLINE = 0;
REMOTE = 1;
}
DataType type = 1;
bytes inline_segment = 3;
RemoteSegment remote = 4;
int64 size = 5;
google.protobuf.Timestamp creation_date = 6;
google.protobuf.Timestamp expiration_date = 7;
bytes metadata = 8;
}
// PutRequest is a request message for the Put rpc call
message PutRequest {
bytes path = 1;
Pointer pointer = 2;
bytes APIKey = 3;
}
// GetRequest is a request message for the Get rpc call
message GetRequest {
bytes path = 1;
bytes APIKey = 2;
}
// ListRequest is a request message for the List rpc call
message ListRequest {
bytes starting_path_key = 1; // the Path key in the bucket to start listing
int64 limit = 2; // how many keys to list
bytes APIKey = 3;
}
// PutResponse is a response message for the Put rpc call
message PutResponse {
}
// GetResponse is a response message for the Get rpc call
message GetResponse {
bytes pointer = 1; // this is a Pointer type marshalled into bytes
}
// ListResponse is a response message for the List rpc call
message ListResponse {
repeated bytes paths = 1;
bool truncated = 2;
}
message DeleteRequest {
bytes path = 1;
bytes APIKey = 2;
}
// DeleteResponse is a response message for the Delete rpc call
message DeleteResponse {
}