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.

307 lines
7.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 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. rpc ListMasterClients (ListMasterClientsRequest) returns (ListMasterClientsResponse) {
  26. }
  27. rpc LeaseAdminToken (LeaseAdminTokenRequest) returns (LeaseAdminTokenResponse) {
  28. }
  29. rpc ReleaseAdminToken (ReleaseAdminTokenRequest) returns (ReleaseAdminTokenResponse) {
  30. }
  31. rpc VerifyAdminToken (VerifyAdminTokenRequest) returns (VerifyAdminTokenResponse) {
  32. }
  33. }
  34. //////////////////////////////////////////////////
  35. message Heartbeat {
  36. string ip = 1;
  37. uint32 port = 2;
  38. string public_url = 3;
  39. uint32 max_volume_count = 4;
  40. uint64 max_file_key = 5;
  41. string data_center = 6;
  42. string rack = 7;
  43. uint32 admin_port = 8;
  44. repeated VolumeInformationMessage volumes = 9;
  45. // delta volumes
  46. repeated VolumeShortInformationMessage new_volumes = 10;
  47. repeated VolumeShortInformationMessage deleted_volumes = 11;
  48. bool has_no_volumes = 12;
  49. // erasure coding
  50. repeated VolumeEcShardInformationMessage ec_shards = 16;
  51. // delta erasure coding shards
  52. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  53. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  54. bool has_no_ec_shards = 19;
  55. }
  56. message HeartbeatResponse {
  57. uint64 volume_size_limit = 1;
  58. string leader = 2;
  59. string metrics_address = 3;
  60. uint32 metrics_interval_seconds = 4;
  61. repeated StorageBackend storage_backends = 5;
  62. }
  63. message VolumeInformationMessage {
  64. uint32 id = 1;
  65. uint64 size = 2;
  66. string collection = 3;
  67. uint64 file_count = 4;
  68. uint64 delete_count = 5;
  69. uint64 deleted_byte_count = 6;
  70. bool read_only = 7;
  71. uint32 replica_placement = 8;
  72. uint32 version = 9;
  73. uint32 ttl = 10;
  74. uint32 compact_revision = 11;
  75. int64 modified_at_second = 12;
  76. string remote_storage_name = 13;
  77. string remote_storage_key = 14;
  78. }
  79. message VolumeShortInformationMessage {
  80. uint32 id = 1;
  81. string collection = 3;
  82. uint32 replica_placement = 8;
  83. uint32 version = 9;
  84. uint32 ttl = 10;
  85. }
  86. message VolumeEcShardInformationMessage {
  87. uint32 id = 1;
  88. string collection = 2;
  89. uint32 ec_index_bits = 3;
  90. }
  91. message StorageBackend {
  92. string type = 1;
  93. string id = 2;
  94. map<string, string> properties = 3;
  95. }
  96. message Empty {
  97. }
  98. message SuperBlockExtra {
  99. message ErasureCoding {
  100. uint32 data = 1;
  101. uint32 parity = 2;
  102. repeated uint32 volume_ids = 3;
  103. }
  104. ErasureCoding erasure_coding = 1;
  105. }
  106. message KeepConnectedRequest {
  107. string name = 1;
  108. uint32 grpc_port = 2;
  109. }
  110. message VolumeLocation {
  111. string url = 1;
  112. string public_url = 2;
  113. repeated uint32 new_vids = 3;
  114. repeated uint32 deleted_vids = 4;
  115. string leader = 5; // optional when leader is not itself
  116. }
  117. message LookupVolumeRequest {
  118. repeated string volume_ids = 1;
  119. string collection = 2; // optional, a bit faster if provided.
  120. }
  121. message LookupVolumeResponse {
  122. message VolumeIdLocation {
  123. string volume_id = 1;
  124. repeated Location locations = 2;
  125. string error = 3;
  126. }
  127. repeated VolumeIdLocation volume_id_locations = 1;
  128. }
  129. message Location {
  130. string url = 1;
  131. string public_url = 2;
  132. }
  133. message AssignRequest {
  134. uint64 count = 1;
  135. string replication = 2;
  136. string collection = 3;
  137. string ttl = 4;
  138. string data_center = 5;
  139. string rack = 6;
  140. string data_node = 7;
  141. uint32 memory_map_max_size_mb = 8;
  142. uint32 Writable_volume_count = 9;
  143. }
  144. message AssignResponse {
  145. string fid = 1;
  146. string url = 2;
  147. string public_url = 3;
  148. uint64 count = 4;
  149. string error = 5;
  150. string auth = 6;
  151. }
  152. message StatisticsRequest {
  153. string replication = 1;
  154. string collection = 2;
  155. string ttl = 3;
  156. }
  157. message StatisticsResponse {
  158. string replication = 1;
  159. string collection = 2;
  160. string ttl = 3;
  161. uint64 total_size = 4;
  162. uint64 used_size = 5;
  163. uint64 file_count = 6;
  164. }
  165. //
  166. // collection related
  167. //
  168. message StorageType {
  169. string replication = 1;
  170. string ttl = 2;
  171. }
  172. message Collection {
  173. string name = 1;
  174. }
  175. message CollectionListRequest {
  176. bool include_normal_volumes = 1;
  177. bool include_ec_volumes = 2;
  178. }
  179. message CollectionListResponse {
  180. repeated Collection collections = 1;
  181. }
  182. message CollectionDeleteRequest {
  183. string name = 1;
  184. }
  185. message CollectionDeleteResponse {
  186. }
  187. //
  188. // volume related
  189. //
  190. message DataNodeInfo {
  191. string id = 1;
  192. uint64 volume_count = 2;
  193. uint64 max_volume_count = 3;
  194. uint64 free_volume_count = 4;
  195. uint64 active_volume_count = 5;
  196. repeated VolumeInformationMessage volume_infos = 6;
  197. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  198. uint64 remote_volume_count = 8;
  199. }
  200. message RackInfo {
  201. string id = 1;
  202. uint64 volume_count = 2;
  203. uint64 max_volume_count = 3;
  204. uint64 free_volume_count = 4;
  205. uint64 active_volume_count = 5;
  206. repeated DataNodeInfo data_node_infos = 6;
  207. uint64 remote_volume_count = 7;
  208. }
  209. message DataCenterInfo {
  210. string id = 1;
  211. uint64 volume_count = 2;
  212. uint64 max_volume_count = 3;
  213. uint64 free_volume_count = 4;
  214. uint64 active_volume_count = 5;
  215. repeated RackInfo rack_infos = 6;
  216. uint64 remote_volume_count = 7;
  217. }
  218. message TopologyInfo {
  219. string id = 1;
  220. uint64 volume_count = 2;
  221. uint64 max_volume_count = 3;
  222. uint64 free_volume_count = 4;
  223. uint64 active_volume_count = 5;
  224. repeated DataCenterInfo data_center_infos = 6;
  225. uint64 remote_volume_count = 7;
  226. }
  227. message VolumeListRequest {
  228. }
  229. message VolumeListResponse {
  230. TopologyInfo topology_info = 1;
  231. uint64 volume_size_limit_mb = 2;
  232. }
  233. message LookupEcVolumeRequest {
  234. uint32 volume_id = 1;
  235. }
  236. message LookupEcVolumeResponse {
  237. uint32 volume_id = 1;
  238. message EcShardIdLocation {
  239. uint32 shard_id = 1;
  240. repeated Location locations = 2;
  241. }
  242. repeated EcShardIdLocation shard_id_locations = 2;
  243. }
  244. message GetMasterConfigurationRequest {
  245. }
  246. message GetMasterConfigurationResponse {
  247. string metrics_address = 1;
  248. uint32 metrics_interval_seconds = 2;
  249. }
  250. message ListMasterClientsRequest {
  251. string client_type = 1;
  252. }
  253. message ListMasterClientsResponse {
  254. repeated string grpc_addresses = 1;
  255. }
  256. message LeaseAdminTokenRequest {
  257. int64 previous_token = 1;
  258. int64 previous_lock_time = 2;
  259. }
  260. message LeaseAdminTokenResponse {
  261. int64 token = 1;
  262. int64 lock_ts_ns = 2;
  263. }
  264. message ReleaseAdminTokenRequest {
  265. int64 previous_token = 1;
  266. int64 previous_lock_time = 2;
  267. }
  268. message ReleaseAdminTokenResponse {
  269. }
  270. message VerifyAdminTokenRequest {
  271. int64 token = 1;
  272. int64 lock_time = 2;
  273. }
  274. message VerifyAdminTokenResponse {
  275. bool is_valid = 1;
  276. }