master.proto 6.4 KB

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