You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
5.6 KiB

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