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.

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