blob: 6372af324234e2e784545c666937d46677fb6d2c [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
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040033 rpc StoreChunk(StoreChunkRequest) returns (StoreChunkResponse) {}
giolekva7be17df2020-03-21 13:57:02 +040034
35 rpc RemoveChunk(RemoveChunkRequest) returns (RemoveChunkResponse) {}
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040036}
37
38message ListChunksRequest {
39}
40
41message ListChunksResponse {
42 repeated string chunk_id = 1;
43}
44
giolekva1f6577a2020-03-25 12:53:06 +040045message CreateChunkRequest {
46 string chunk_id = 1;
47 int32 size = 2;
48 ReplicaRole role = 3;
49 string primary_address = 4;
50}
51
52message CreateChunkResponse {
53}
54
55message GetChunkStatusRequest {
56 string chunk_id = 1;
57}
58
59message GetChunkStatusResponse {
60 ChunkStatus status = 1;
61 int32 total_bytes = 2;
62 int32 committed_bytes = 3;
63}
64
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040065message ReadChunkRequest {
66 string chunk_id = 1;
67 int32 offset = 2;
68 int32 num_bytes = 3;
69}
70
71message ReadChunkResponse {
72 bytes data = 1;
73}
74
giolekva1f6577a2020-03-25 12:53:06 +040075message WriteChunkRequest {
76 string chunk_id = 1;
77 int32 offset = 2;
78 bytes data = 3;
79}
80
81message WriteChunkResponse {
82 int32 bytes_written = 1;
83}
84
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +040085message StoreChunkRequest {
86 string chunk_id = 1;
87 bytes data = 2;
88}
89
90message StoreChunkResponse {
91}
92
giolekva7be17df2020-03-21 13:57:02 +040093message RemoveChunkRequest {
94 string chunk_id = 1;
95}
96
97message RemoveChunkResponse {
98}
99
Giorgi Lekveishvilic548ec52020-03-16 21:59:14 +0400100// MetadataStorage
101
102message ChunkStorageMetadata {
103 string chunk_id = 1;
104 int32 size_bytes = 2;
105 repeated string server = 3;
106}
107
108service MetadataStorage {
109 rpc AddChunkServer(AddChunkServerRequest) returns (AddChunkServerResponse) {}
110
111 rpc CreateBlob(CreateBlobRequest) returns (CreateBlobResponse) {}
112
113 rpc GetBlobMetadata(GetBlobMetadataRequest) returns (GetBlobMetadataResponse) {}
114}
115
116message AddChunkServerRequest {
117 string address = 1;
118}
119
120message AddChunkServerResponse {
121}
122
123message CreateBlobRequest {
124 int32 size_bytes = 1;
125 int32 chunk_size_bytes = 2;
126 int32 num_replicas = 3;
127}
128
129message CreateBlobResponse {
130 string blob_id = 1;
131 repeated ChunkStorageMetadata chunk = 2;
132}
133
134message GetBlobMetadataRequest {
135 string blob_id = 1;
136}
137
138message GetBlobMetadataResponse {
139 string blob_id = 1;
140 int32 size_bytes = 2;
141 repeated ChunkStorageMetadata chunk = 3;
142}