aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Chen <b03705028@ntu.edu.tw>2019-06-05 18:28:57 +0800
committerDavid Chen <b03705028@ntu.edu.tw>2019-06-05 18:28:57 +0800
commitf2dfae232bed9f81f9f5da3f05123b5aecbbc313 (patch)
treef6a7ded4428f48f16c834fe9a87f3372a50e46b9
parent6411e730a8bdb02b539580ebda90811d54a22d83 (diff)
downloadcns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar.gz
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar.bz2
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar.lz
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar.xz
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.tar.zst
cns-final-tor-store-f2dfae232bed9f81f9f5da3f05123b5aecbbc313.zip
Add gRPC interface
-rw-r--r--chunk.proto32
1 files changed, 32 insertions, 0 deletions
diff --git a/chunk.proto b/chunk.proto
new file mode 100644
index 0000000..246ba9b
--- /dev/null
+++ b/chunk.proto
@@ -0,0 +1,32 @@
+syntax = "proto3";
+
+option go_package = "main";
+
+package chunk;
+
+import "google/protobuf/empty.proto";
+import "google/protobuf/wrappers.proto";
+
+// The order of the chunks in the inbound stream
+// may not be the same as that in the outbound stream.
+// Take upload for example,
+// inbound: [val1, val2, val3] may yield outbound: [key2, key3, key1].
+// This facilitates the storage server to concurrently upload to/download from Tor.
+service Server {
+ // Avoid hard-coding chunk size
+ // because implementation changes in storage server may affect this value
+ rpc GetChunkSize(google.protobuf.Empty) returns (google.protobuf.UInt32Value) {}
+ rpc Upload(stream Chunk) returns (stream Chunk) {}
+ rpc Download(stream Chunk) returns (stream Chunk) {}
+}
+
+message Chunk {
+ // Idx refers to the chunk index within this storage object.
+ // Since a bidirectional stream is used for each uploading or downloading operation,
+ // all chunks appearing in a stream belong to the same storage object,
+ // and that's why we only need to distinguish a chunk's index within a storage object,
+ // but not a global index among all storage objects.
+ uint32 Idx = 1;
+ // Data may comtain value (public key of hidden service) or key (hash of public key)
+ bytes Data = 2;
+} \ No newline at end of file