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.

260 lines
6.2 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. repeated StorageBackend storage_backends = 5;
  54. }
  55. message VolumeInformationMessage {
  56. uint32 id = 1;
  57. uint64 size = 2;
  58. string collection = 3;
  59. uint64 file_count = 4;
  60. uint64 delete_count = 5;
  61. uint64 deleted_byte_count = 6;
  62. bool read_only = 7;
  63. uint32 replica_placement = 8;
  64. uint32 version = 9;
  65. uint32 ttl = 10;
  66. uint32 compact_revision = 11;
  67. int64 modified_at_second = 12;
  68. }
  69. message VolumeShortInformationMessage {
  70. uint32 id = 1;
  71. string collection = 3;
  72. uint32 replica_placement = 8;
  73. uint32 version = 9;
  74. uint32 ttl = 10;
  75. }
  76. message VolumeEcShardInformationMessage {
  77. uint32 id = 1;
  78. string collection = 2;
  79. uint32 ec_index_bits = 3;
  80. }
  81. message StorageBackend {
  82. string type = 1;
  83. string id = 2;
  84. map<string, string> properties = 3;
  85. }
  86. message Empty {
  87. }
  88. message SuperBlockExtra {
  89. message ErasureCoding {
  90. uint32 data = 1;
  91. uint32 parity = 2;
  92. repeated uint32 volume_ids = 3;
  93. }
  94. ErasureCoding erasure_coding = 1;
  95. }
  96. message KeepConnectedRequest {
  97. string name = 1;
  98. }
  99. message VolumeLocation {
  100. string url = 1;
  101. string public_url = 2;
  102. repeated uint32 new_vids = 3;
  103. repeated uint32 deleted_vids = 4;
  104. string leader = 5; // optional when leader is not itself
  105. }
  106. message LookupVolumeRequest {
  107. repeated string volume_ids = 1;
  108. string collection = 2; // optional, a bit faster if provided.
  109. }
  110. message LookupVolumeResponse {
  111. message VolumeIdLocation {
  112. string volume_id = 1;
  113. repeated Location locations = 2;
  114. string error = 3;
  115. }
  116. repeated VolumeIdLocation volume_id_locations = 1;
  117. }
  118. message Location {
  119. string url = 1;
  120. string public_url = 2;
  121. }
  122. message AssignRequest {
  123. uint64 count = 1;
  124. string replication = 2;
  125. string collection = 3;
  126. string ttl = 4;
  127. string data_center = 5;
  128. string rack = 6;
  129. string data_node = 7;
  130. uint32 memory_map_max_size_mb = 8;
  131. uint32 Writable_volume_count = 9;
  132. }
  133. message AssignResponse {
  134. string fid = 1;
  135. string url = 2;
  136. string public_url = 3;
  137. uint64 count = 4;
  138. string error = 5;
  139. string auth = 6;
  140. }
  141. message StatisticsRequest {
  142. string replication = 1;
  143. string collection = 2;
  144. string ttl = 3;
  145. }
  146. message StatisticsResponse {
  147. string replication = 1;
  148. string collection = 2;
  149. string ttl = 3;
  150. uint64 total_size = 4;
  151. uint64 used_size = 5;
  152. uint64 file_count = 6;
  153. }
  154. //
  155. // collection related
  156. //
  157. message StorageType {
  158. string replication = 1;
  159. string ttl = 2;
  160. }
  161. message Collection {
  162. string name = 1;
  163. }
  164. message CollectionListRequest {
  165. bool include_normal_volumes = 1;
  166. bool include_ec_volumes = 2;
  167. }
  168. message CollectionListResponse {
  169. repeated Collection collections = 1;
  170. }
  171. message CollectionDeleteRequest {
  172. string name = 1;
  173. }
  174. message CollectionDeleteResponse {
  175. }
  176. //
  177. // volume related
  178. //
  179. message DataNodeInfo {
  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 VolumeInformationMessage volume_infos = 6;
  186. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  187. }
  188. message RackInfo {
  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 DataNodeInfo data_node_infos = 6;
  195. }
  196. message DataCenterInfo {
  197. string id = 1;
  198. uint64 volume_count = 2;
  199. uint64 max_volume_count = 3;
  200. uint64 free_volume_count = 4;
  201. uint64 active_volume_count = 5;
  202. repeated RackInfo rack_infos = 6;
  203. }
  204. message TopologyInfo {
  205. string id = 1;
  206. uint64 volume_count = 2;
  207. uint64 max_volume_count = 3;
  208. uint64 free_volume_count = 4;
  209. uint64 active_volume_count = 5;
  210. repeated DataCenterInfo data_center_infos = 6;
  211. }
  212. message VolumeListRequest {
  213. }
  214. message VolumeListResponse {
  215. TopologyInfo topology_info = 1;
  216. uint64 volume_size_limit_mb = 2;
  217. }
  218. message LookupEcVolumeRequest {
  219. uint32 volume_id = 1;
  220. }
  221. message LookupEcVolumeResponse {
  222. uint32 volume_id = 1;
  223. message EcShardIdLocation {
  224. uint32 shard_id = 1;
  225. repeated Location locations = 2;
  226. }
  227. repeated EcShardIdLocation shard_id_locations = 2;
  228. }
  229. message GetMasterConfigurationRequest {
  230. }
  231. message GetMasterConfigurationResponse {
  232. string metrics_address = 1;
  233. uint32 metrics_interval_seconds = 2;
  234. }