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.

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