blob: 56a8e9e167aa8c143feeac0f8a6d3f8700d50b4b [file] [log] [blame]
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +04001syntax = "proto3";
2
Giorgi Lekveishvilib8f089f2020-03-18 23:28:12 +04003package pcloud.api;
4
5option go_package = "api";
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +04006
giolekva1f6577a2020-03-25 12:53:06 +04007enum ChunkStatus {
8 NEW = 0;
9 CREATED = 1;
10 WRITING = 2;
11 REPLICATING = 3;
12 READY = 4;
13}
14
15enum ReplicaRole {
16 SECONDARY = 0;
17 PRIMARY = 1;
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040018}
19
20// ChunkStorage
21
22service ChunkStorage {
23 rpc ListChunks(ListChunksRequest) returns (ListChunksResponse) {}
24
giolekva1f6577a2020-03-25 12:53:06 +040025 rpc CreateChunk(CreateChunkRequest) returns (CreateChunkResponse) {}
26
27 rpc GetChunkStatus(GetChunkStatusRequest) returns (GetChunkStatusResponse) {}
28
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040029 rpc ReadChunk(ReadChunkRequest) returns (ReadChunkResponse) {}
30
giolekva1f6577a2020-03-25 12:53:06 +040031 rpc WriteChunk(WriteChunkRequest) returns (WriteChunkResponse) {}
32
giolekva7be17df2020-03-21 13:57:02 +040033 rpc RemoveChunk(RemoveChunkRequest) returns (RemoveChunkResponse) {}
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040034}
35
36message ListChunksRequest {
37}
38
39message ListChunksResponse {
40 repeated string chunk_id = 1;
41}
42
giolekva1f6577a2020-03-25 12:53:06 +040043message CreateChunkRequest {
44 string chunk_id = 1;
45 int32 size = 2;
46 ReplicaRole role = 3;
47 string primary_address = 4;
48}
49
50message CreateChunkResponse {
51}
52
53message GetChunkStatusRequest {
54 string chunk_id = 1;
55}
56
57message GetChunkStatusResponse {
58 ChunkStatus status = 1;
59 int32 total_bytes = 2;
60 int32 committed_bytes = 3;
61}
62
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040063message ReadChunkRequest {
64 string chunk_id = 1;
65 int32 offset = 2;
66 int32 num_bytes = 3;
67}
68
69message ReadChunkResponse {
70 bytes data = 1;
71}
72
giolekva1f6577a2020-03-25 12:53:06 +040073message WriteChunkRequest {
74 string chunk_id = 1;
75 int32 offset = 2;
76 bytes data = 3;
77}
78
79message WriteChunkResponse {
80 int32 bytes_written = 1;
81}
82
giolekva7be17df2020-03-21 13:57:02 +040083message RemoveChunkRequest {
84 string chunk_id = 1;
85}
86
87message RemoveChunkResponse {
88}
89
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040090// MetadataStorage
91
92message ChunkStorageMetadata {
93 string chunk_id = 1;
94 int32 size_bytes = 2;
95 repeated string server = 3;
96}
97
98service MetadataStorage {
99 rpc AddChunkServer(AddChunkServerRequest) returns (AddChunkServerResponse) {}
100
101 rpc CreateBlob(CreateBlobRequest) returns (CreateBlobResponse) {}
102
103 rpc GetBlobMetadata(GetBlobMetadataRequest) returns (GetBlobMetadataResponse) {}
104}
105
106message AddChunkServerRequest {
107 string address = 1;
108}
109
110message AddChunkServerResponse {
111}
112
113message CreateBlobRequest {
114 int32 size_bytes = 1;
115 int32 chunk_size_bytes = 2;
116 int32 num_replicas = 3;
117}
118
119message CreateBlobResponse {
120 string blob_id = 1;
121 repeated ChunkStorageMetadata chunk = 2;
122}
123
124message GetBlobMetadataRequest {
125 string blob_id = 1;
126}
127
128message GetBlobMetadataResponse {
129 string blob_id = 1;
130 int32 size_bytes = 2;
131 repeated ChunkStorageMetadata chunk = 3;
132}