master.proto 6.0 KB

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