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.

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