master.proto 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. syntax = "proto3";
  2. package master_pb;
  3. //////////////////////////////////////////////////
  4. service Seaweed {
  5. rpc SendHeartbeat (stream Heartbeat) returns (stream HeartbeatResponse) {
  6. }
  7. rpc KeepConnected (stream KeepConnectedRequest) returns (stream VolumeLocation) {
  8. }
  9. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  10. }
  11. rpc Assign (AssignRequest) returns (AssignResponse) {
  12. }
  13. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  14. }
  15. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  16. }
  17. rpc CollectionDelete (CollectionDeleteRequest) returns (CollectionDeleteResponse) {
  18. }
  19. rpc VolumeList (VolumeListRequest) returns (VolumeListResponse) {
  20. }
  21. rpc LookupEcVolume (LookupEcVolumeRequest) returns (LookupEcVolumeResponse) {
  22. }
  23. rpc GetMasterConfiguration (GetMasterConfigurationRequest) returns (GetMasterConfigurationResponse) {
  24. }
  25. rpc ListMasterClients (ListMasterClientsRequest) returns (ListMasterClientsResponse) {
  26. }
  27. }
  28. //////////////////////////////////////////////////
  29. message Heartbeat {
  30. string ip = 1;
  31. uint32 port = 2;
  32. string public_url = 3;
  33. uint32 max_volume_count = 4;
  34. uint64 max_file_key = 5;
  35. string data_center = 6;
  36. string rack = 7;
  37. uint32 admin_port = 8;
  38. repeated VolumeInformationMessage volumes = 9;
  39. // delta volumes
  40. repeated VolumeShortInformationMessage new_volumes = 10;
  41. repeated VolumeShortInformationMessage deleted_volumes = 11;
  42. bool has_no_volumes = 12;
  43. // erasure coding
  44. repeated VolumeEcShardInformationMessage ec_shards = 16;
  45. // delta erasure coding shards
  46. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  47. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  48. bool has_no_ec_shards = 19;
  49. }
  50. message HeartbeatResponse {
  51. uint64 volume_size_limit = 1;
  52. string leader = 2;
  53. string metrics_address = 3;
  54. uint32 metrics_interval_seconds = 4;
  55. repeated StorageBackend storage_backends = 5;
  56. }
  57. message VolumeInformationMessage {
  58. uint32 id = 1;
  59. uint64 size = 2;
  60. string collection = 3;
  61. uint64 file_count = 4;
  62. uint64 delete_count = 5;
  63. uint64 deleted_byte_count = 6;
  64. bool read_only = 7;
  65. uint32 replica_placement = 8;
  66. uint32 version = 9;
  67. uint32 ttl = 10;
  68. uint32 compact_revision = 11;
  69. int64 modified_at_second = 12;
  70. string remote_storage_name = 13;
  71. string remote_storage_key = 14;
  72. }
  73. message VolumeShortInformationMessage {
  74. uint32 id = 1;
  75. string collection = 3;
  76. uint32 replica_placement = 8;
  77. uint32 version = 9;
  78. uint32 ttl = 10;
  79. }
  80. message VolumeEcShardInformationMessage {
  81. uint32 id = 1;
  82. string collection = 2;
  83. uint32 ec_index_bits = 3;
  84. }
  85. message StorageBackend {
  86. string type = 1;
  87. string id = 2;
  88. map<string, string> properties = 3;
  89. }
  90. message Empty {
  91. }
  92. message SuperBlockExtra {
  93. message ErasureCoding {
  94. uint32 data = 1;
  95. uint32 parity = 2;
  96. repeated uint32 volume_ids = 3;
  97. }
  98. ErasureCoding erasure_coding = 1;
  99. }
  100. message KeepConnectedRequest {
  101. string name = 1;
  102. uint32 grpc_port = 2;
  103. }
  104. message VolumeLocation {
  105. string url = 1;
  106. string public_url = 2;
  107. repeated uint32 new_vids = 3;
  108. repeated uint32 deleted_vids = 4;
  109. string leader = 5; // optional when leader is not itself
  110. }
  111. message LookupVolumeRequest {
  112. repeated string volume_ids = 1;
  113. string collection = 2; // optional, a bit faster if provided.
  114. }
  115. message LookupVolumeResponse {
  116. message VolumeIdLocation {
  117. string volume_id = 1;
  118. repeated Location locations = 2;
  119. string error = 3;
  120. }
  121. repeated VolumeIdLocation volume_id_locations = 1;
  122. }
  123. message Location {
  124. string url = 1;
  125. string public_url = 2;
  126. }
  127. message AssignRequest {
  128. uint64 count = 1;
  129. string replication = 2;
  130. string collection = 3;
  131. string ttl = 4;
  132. string data_center = 5;
  133. string rack = 6;
  134. string data_node = 7;
  135. uint32 memory_map_max_size_mb = 8;
  136. uint32 Writable_volume_count = 9;
  137. }
  138. message AssignResponse {
  139. string fid = 1;
  140. string url = 2;
  141. string public_url = 3;
  142. uint64 count = 4;
  143. string error = 5;
  144. string auth = 6;
  145. }
  146. message StatisticsRequest {
  147. string replication = 1;
  148. string collection = 2;
  149. string ttl = 3;
  150. }
  151. message StatisticsResponse {
  152. string replication = 1;
  153. string collection = 2;
  154. string ttl = 3;
  155. uint64 total_size = 4;
  156. uint64 used_size = 5;
  157. uint64 file_count = 6;
  158. }
  159. //
  160. // collection related
  161. //
  162. message StorageType {
  163. string replication = 1;
  164. string ttl = 2;
  165. }
  166. message Collection {
  167. string name = 1;
  168. }
  169. message CollectionListRequest {
  170. bool include_normal_volumes = 1;
  171. bool include_ec_volumes = 2;
  172. }
  173. message CollectionListResponse {
  174. repeated Collection collections = 1;
  175. }
  176. message CollectionDeleteRequest {
  177. string name = 1;
  178. }
  179. message CollectionDeleteResponse {
  180. }
  181. //
  182. // volume related
  183. //
  184. message DataNodeInfo {
  185. string id = 1;
  186. uint64 volume_count = 2;
  187. uint64 max_volume_count = 3;
  188. uint64 free_volume_count = 4;
  189. uint64 active_volume_count = 5;
  190. repeated VolumeInformationMessage volume_infos = 6;
  191. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  192. uint64 remote_volume_count = 8;
  193. }
  194. message RackInfo {
  195. string id = 1;
  196. uint64 volume_count = 2;
  197. uint64 max_volume_count = 3;
  198. uint64 free_volume_count = 4;
  199. uint64 active_volume_count = 5;
  200. repeated DataNodeInfo data_node_infos = 6;
  201. uint64 remote_volume_count = 7;
  202. }
  203. message DataCenterInfo {
  204. string id = 1;
  205. uint64 volume_count = 2;
  206. uint64 max_volume_count = 3;
  207. uint64 free_volume_count = 4;
  208. uint64 active_volume_count = 5;
  209. repeated RackInfo rack_infos = 6;
  210. uint64 remote_volume_count = 7;
  211. }
  212. message TopologyInfo {
  213. string id = 1;
  214. uint64 volume_count = 2;
  215. uint64 max_volume_count = 3;
  216. uint64 free_volume_count = 4;
  217. uint64 active_volume_count = 5;
  218. repeated DataCenterInfo data_center_infos = 6;
  219. uint64 remote_volume_count = 7;
  220. }
  221. message VolumeListRequest {
  222. }
  223. message VolumeListResponse {
  224. TopologyInfo topology_info = 1;
  225. uint64 volume_size_limit_mb = 2;
  226. }
  227. message LookupEcVolumeRequest {
  228. uint32 volume_id = 1;
  229. }
  230. message LookupEcVolumeResponse {
  231. uint32 volume_id = 1;
  232. message EcShardIdLocation {
  233. uint32 shard_id = 1;
  234. repeated Location locations = 2;
  235. }
  236. repeated EcShardIdLocation shard_id_locations = 2;
  237. }
  238. message GetMasterConfigurationRequest {
  239. }
  240. message GetMasterConfigurationResponse {
  241. string metrics_address = 1;
  242. uint32 metrics_interval_seconds = 2;
  243. }
  244. message ListMasterClientsRequest {
  245. string client_type = 1;
  246. }
  247. message ListMasterClientsResponse {
  248. repeated string grpc_addresses = 1;
  249. }