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.

252 lines
6.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 KeepConnectedRequest) 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 KeepConnectedRequest {
  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. string leader = 5; // optional when leader is not itself
  99. }
  100. message LookupVolumeRequest {
  101. repeated string volume_ids = 1;
  102. string collection = 2; // optional, a bit faster if provided.
  103. }
  104. message LookupVolumeResponse {
  105. message VolumeIdLocation {
  106. string volume_id = 1;
  107. repeated Location locations = 2;
  108. string error = 3;
  109. }
  110. repeated VolumeIdLocation volume_id_locations = 1;
  111. }
  112. message Location {
  113. string url = 1;
  114. string public_url = 2;
  115. }
  116. message AssignRequest {
  117. uint64 count = 1;
  118. string replication = 2;
  119. string collection = 3;
  120. string ttl = 4;
  121. string data_center = 5;
  122. string rack = 6;
  123. string data_node = 7;
  124. uint32 memory_map_max_size_mb = 8;
  125. }
  126. message AssignResponse {
  127. string fid = 1;
  128. string url = 2;
  129. string public_url = 3;
  130. uint64 count = 4;
  131. string error = 5;
  132. string auth = 6;
  133. }
  134. message StatisticsRequest {
  135. string replication = 1;
  136. string collection = 2;
  137. string ttl = 3;
  138. }
  139. message StatisticsResponse {
  140. string replication = 1;
  141. string collection = 2;
  142. string ttl = 3;
  143. uint64 total_size = 4;
  144. uint64 used_size = 5;
  145. uint64 file_count = 6;
  146. }
  147. //
  148. // collection related
  149. //
  150. message StorageType {
  151. string replication = 1;
  152. string ttl = 2;
  153. }
  154. message Collection {
  155. string name = 1;
  156. }
  157. message CollectionListRequest {
  158. bool include_normal_volumes = 1;
  159. bool include_ec_volumes = 2;
  160. }
  161. message CollectionListResponse {
  162. repeated Collection collections = 1;
  163. }
  164. message CollectionDeleteRequest {
  165. string name = 1;
  166. }
  167. message CollectionDeleteResponse {
  168. }
  169. //
  170. // volume related
  171. //
  172. message DataNodeInfo {
  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 VolumeInformationMessage volume_infos = 6;
  179. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  180. }
  181. message RackInfo {
  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 DataNodeInfo data_node_infos = 6;
  188. }
  189. message DataCenterInfo {
  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 RackInfo rack_infos = 6;
  196. }
  197. message TopologyInfo {
  198. string id = 1;
  199. uint64 volume_count = 2;
  200. uint64 max_volume_count = 3;
  201. uint64 free_volume_count = 4;
  202. uint64 active_volume_count = 5;
  203. repeated DataCenterInfo data_center_infos = 6;
  204. }
  205. message VolumeListRequest {
  206. }
  207. message VolumeListResponse {
  208. TopologyInfo topology_info = 1;
  209. uint64 volume_size_limit_mb = 2;
  210. }
  211. message LookupEcVolumeRequest {
  212. uint32 volume_id = 1;
  213. }
  214. message LookupEcVolumeResponse {
  215. uint32 volume_id = 1;
  216. message EcShardIdLocation {
  217. uint32 shard_id = 1;
  218. repeated Location locations = 2;
  219. }
  220. repeated EcShardIdLocation shard_id_locations = 2;
  221. }
  222. message GetMasterConfigurationRequest {
  223. }
  224. message GetMasterConfigurationResponse {
  225. string metrics_address = 1;
  226. uint32 metrics_interval_seconds = 2;
  227. }