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.

234 lines
5.4 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. }
  150. message CollectionListResponse {
  151. repeated Collection collections = 1;
  152. }
  153. message CollectionDeleteRequest {
  154. string name = 1;
  155. }
  156. message CollectionDeleteResponse {
  157. }
  158. //
  159. // volume related
  160. //
  161. message DataNodeInfo {
  162. string id = 1;
  163. uint64 volume_count = 2;
  164. uint64 max_volume_count = 3;
  165. uint64 free_volume_count = 4;
  166. uint64 active_volume_count = 5;
  167. repeated VolumeInformationMessage volume_infos = 6;
  168. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  169. }
  170. message RackInfo {
  171. string id = 1;
  172. uint64 volume_count = 2;
  173. uint64 max_volume_count = 3;
  174. uint64 free_volume_count = 4;
  175. uint64 active_volume_count = 5;
  176. repeated DataNodeInfo data_node_infos = 6;
  177. }
  178. message DataCenterInfo {
  179. string id = 1;
  180. uint64 volume_count = 2;
  181. uint64 max_volume_count = 3;
  182. uint64 free_volume_count = 4;
  183. uint64 active_volume_count = 5;
  184. repeated RackInfo rack_infos = 6;
  185. }
  186. message TopologyInfo {
  187. string id = 1;
  188. uint64 volume_count = 2;
  189. uint64 max_volume_count = 3;
  190. uint64 free_volume_count = 4;
  191. uint64 active_volume_count = 5;
  192. repeated DataCenterInfo data_center_infos = 6;
  193. }
  194. message VolumeListRequest {
  195. }
  196. message VolumeListResponse {
  197. TopologyInfo topology_info = 1;
  198. uint64 volume_size_limit_mb = 2;
  199. }
  200. message LookupEcVolumeRequest {
  201. uint32 volume_id = 1;
  202. }
  203. message LookupEcVolumeResponse {
  204. uint32 volume_id = 1;
  205. message EcShardIdLocation {
  206. uint32 shard_id = 1;
  207. repeated Location locations = 2;
  208. }
  209. repeated EcShardIdLocation shard_id_locations = 2;
  210. }