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.

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