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.

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