blob: 56a8e9e167aa8c143feeac0f8a6d3f8700d50b4b [file] [log] [blame]
giolekva892a4e22020-04-27 16:46:22 +04001syntax = "proto3";
2
3package pcloud.api;
4
5option go_package = "api";
6
7enum 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;
18}
19
20// ChunkStorage
21
22service ChunkStorage {
23 rpc ListChunks(ListChunksRequest) returns (ListChunksResponse) {}
24
25 rpc CreateChunk(CreateChunkRequest) returns (CreateChunkResponse) {}
26
27 rpc GetChunkStatus(GetChunkStatusRequest) returns (GetChunkStatusResponse) {}
28
29 rpc ReadChunk(ReadChunkRequest) returns (ReadChunkResponse) {}
30
31 rpc WriteChunk(WriteChunkRequest) returns (WriteChunkResponse) {}
32
33 rpc RemoveChunk(RemoveChunkRequest) returns (RemoveChunkResponse) {}
34}
35
36message ListChunksRequest {
37}
38
39message ListChunksResponse {
40 repeated string chunk_id = 1;
41}
42
43message 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
63message 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
73message 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
83message RemoveChunkRequest {
84 string chunk_id = 1;
85}
86
87message RemoveChunkResponse {
88}
89
90// 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}