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.

438 lines
10 KiB

5 years ago
7 years ago
3 years ago
7 years ago
7 years ago
4 months ago
  1. syntax = "proto3";
  2. package master_pb;
  3. option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/master_pb";
  4. //////////////////////////////////////////////////
  5. service Seaweed {
  6. rpc SendHeartbeat (stream Heartbeat) returns (stream HeartbeatResponse) {
  7. }
  8. rpc KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  9. }
  10. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  11. }
  12. rpc Assign (AssignRequest) returns (AssignResponse) {
  13. }
  14. rpc StreamAssign (stream AssignRequest) returns (stream AssignResponse) {
  15. }
  16. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  17. }
  18. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  19. }
  20. rpc CollectionDelete (CollectionDeleteRequest) returns (CollectionDeleteResponse) {
  21. }
  22. rpc VolumeList (VolumeListRequest) returns (VolumeListResponse) {
  23. }
  24. rpc LookupEcVolume (LookupEcVolumeRequest) returns (LookupEcVolumeResponse) {
  25. }
  26. rpc VacuumVolume (VacuumVolumeRequest) returns (VacuumVolumeResponse) {
  27. }
  28. rpc DisableVacuum (DisableVacuumRequest) returns (DisableVacuumResponse) {
  29. }
  30. rpc EnableVacuum (EnableVacuumRequest) returns (EnableVacuumResponse) {
  31. }
  32. rpc VolumeMarkReadonly (VolumeMarkReadonlyRequest) returns (VolumeMarkReadonlyResponse) {
  33. }
  34. rpc GetMasterConfiguration (GetMasterConfigurationRequest) returns (GetMasterConfigurationResponse) {
  35. }
  36. rpc ListClusterNodes (ListClusterNodesRequest) returns (ListClusterNodesResponse) {
  37. }
  38. rpc LeaseAdminToken (LeaseAdminTokenRequest) returns (LeaseAdminTokenResponse) {
  39. }
  40. rpc ReleaseAdminToken (ReleaseAdminTokenRequest) returns (ReleaseAdminTokenResponse) {
  41. }
  42. rpc Ping (PingRequest) returns (PingResponse) {
  43. }
  44. rpc RaftListClusterServers (RaftListClusterServersRequest) returns (RaftListClusterServersResponse) {
  45. }
  46. rpc RaftAddServer (RaftAddServerRequest) returns (RaftAddServerResponse) {
  47. }
  48. rpc RaftRemoveServer (RaftRemoveServerRequest) returns (RaftRemoveServerResponse) {
  49. }
  50. rpc VolumeGrow (VolumeGrowRequest) returns (VolumeGrowResponse) {
  51. }
  52. }
  53. //////////////////////////////////////////////////
  54. message Heartbeat {
  55. string ip = 1;
  56. uint32 port = 2;
  57. string public_url = 3;
  58. uint64 max_file_key = 5;
  59. string data_center = 6;
  60. string rack = 7;
  61. uint32 admin_port = 8;
  62. repeated VolumeInformationMessage volumes = 9;
  63. // delta volumes
  64. repeated VolumeShortInformationMessage new_volumes = 10;
  65. repeated VolumeShortInformationMessage deleted_volumes = 11;
  66. bool has_no_volumes = 12;
  67. // erasure coding
  68. repeated VolumeEcShardInformationMessage ec_shards = 16;
  69. // delta erasure coding shards
  70. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  71. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  72. bool has_no_ec_shards = 19;
  73. map<string, uint32> max_volume_counts = 4;
  74. uint32 grpc_port = 20;
  75. repeated string location_uuids = 21;
  76. }
  77. message HeartbeatResponse {
  78. uint64 volume_size_limit = 1;
  79. string leader = 2;
  80. string metrics_address = 3;
  81. uint32 metrics_interval_seconds = 4;
  82. repeated StorageBackend storage_backends = 5;
  83. repeated string duplicated_uuids = 6;
  84. }
  85. message VolumeInformationMessage {
  86. uint32 id = 1;
  87. uint64 size = 2;
  88. string collection = 3;
  89. uint64 file_count = 4;
  90. uint64 delete_count = 5;
  91. uint64 deleted_byte_count = 6;
  92. bool read_only = 7;
  93. uint32 replica_placement = 8;
  94. uint32 version = 9;
  95. uint32 ttl = 10;
  96. uint32 compact_revision = 11;
  97. int64 modified_at_second = 12;
  98. string remote_storage_name = 13;
  99. string remote_storage_key = 14;
  100. string disk_type = 15;
  101. }
  102. message VolumeShortInformationMessage {
  103. uint32 id = 1;
  104. string collection = 3;
  105. uint32 replica_placement = 8;
  106. uint32 version = 9;
  107. uint32 ttl = 10;
  108. string disk_type = 15;
  109. }
  110. message VolumeEcShardInformationMessage {
  111. uint32 id = 1;
  112. string collection = 2;
  113. uint32 ec_index_bits = 3;
  114. string disk_type = 4;
  115. uint64 destroy_time = 5; // used to record the destruction time of ec volume
  116. }
  117. message StorageBackend {
  118. string type = 1;
  119. string id = 2;
  120. map<string, string> properties = 3;
  121. }
  122. message Empty {
  123. }
  124. message SuperBlockExtra {
  125. message ErasureCoding {
  126. uint32 data = 1;
  127. uint32 parity = 2;
  128. repeated uint32 volume_ids = 3;
  129. }
  130. ErasureCoding erasure_coding = 1;
  131. }
  132. message KeepConnectedRequest {
  133. string client_type = 1;
  134. string client_address = 3;
  135. string version = 4;
  136. string filer_group = 5;
  137. string data_center = 6;
  138. string rack = 7;
  139. }
  140. message VolumeLocation {
  141. string url = 1;
  142. string public_url = 2;
  143. repeated uint32 new_vids = 3;
  144. repeated uint32 deleted_vids = 4;
  145. string leader = 5; // optional when leader is not itself
  146. string data_center = 6; // optional when DataCenter is in use
  147. uint32 grpc_port = 7;
  148. repeated uint32 new_ec_vids = 8;
  149. repeated uint32 deleted_ec_vids = 9;
  150. }
  151. message ClusterNodeUpdate {
  152. string node_type = 1;
  153. string address = 2;
  154. bool is_add = 4;
  155. string filer_group = 5;
  156. int64 created_at_ns = 6;
  157. }
  158. message KeepConnectedResponse {
  159. VolumeLocation volume_location = 1;
  160. ClusterNodeUpdate cluster_node_update = 2;
  161. }
  162. message LookupVolumeRequest {
  163. repeated string volume_or_file_ids = 1;
  164. string collection = 2; // optional, a bit faster if provided.
  165. }
  166. message LookupVolumeResponse {
  167. message VolumeIdLocation {
  168. string volume_or_file_id = 1;
  169. repeated Location locations = 2;
  170. string error = 3;
  171. string auth = 4;
  172. }
  173. repeated VolumeIdLocation volume_id_locations = 1;
  174. }
  175. message Location {
  176. string url = 1;
  177. string public_url = 2;
  178. uint32 grpc_port = 3;
  179. string data_center = 4;
  180. }
  181. message AssignRequest {
  182. uint64 count = 1;
  183. string replication = 2;
  184. string collection = 3;
  185. string ttl = 4;
  186. string data_center = 5;
  187. string rack = 6;
  188. string data_node = 7;
  189. uint32 memory_map_max_size_mb = 8;
  190. uint32 writable_volume_count = 9;
  191. string disk_type = 10;
  192. }
  193. message VolumeGrowRequest {
  194. uint32 writable_volume_count = 1;
  195. string replication = 2;
  196. string collection = 3;
  197. string ttl = 4;
  198. string data_center = 5;
  199. string rack = 6;
  200. string data_node = 7;
  201. uint32 memory_map_max_size_mb = 8;
  202. string disk_type = 9;
  203. }
  204. message AssignResponse {
  205. string fid = 1;
  206. uint64 count = 4;
  207. string error = 5;
  208. string auth = 6;
  209. repeated Location replicas = 7;
  210. Location location = 8;
  211. }
  212. message StatisticsRequest {
  213. string replication = 1;
  214. string collection = 2;
  215. string ttl = 3;
  216. string disk_type = 4;
  217. }
  218. message StatisticsResponse {
  219. uint64 total_size = 4;
  220. uint64 used_size = 5;
  221. uint64 file_count = 6;
  222. }
  223. //
  224. // collection related
  225. //
  226. message Collection {
  227. string name = 1;
  228. }
  229. message CollectionListRequest {
  230. bool include_normal_volumes = 1;
  231. bool include_ec_volumes = 2;
  232. }
  233. message CollectionListResponse {
  234. repeated Collection collections = 1;
  235. }
  236. message CollectionDeleteRequest {
  237. string name = 1;
  238. }
  239. message CollectionDeleteResponse {
  240. }
  241. //
  242. // volume related
  243. //
  244. message DiskInfo {
  245. string type = 1;
  246. int64 volume_count = 2;
  247. int64 max_volume_count = 3;
  248. int64 free_volume_count = 4;
  249. int64 active_volume_count = 5;
  250. repeated VolumeInformationMessage volume_infos = 6;
  251. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  252. int64 remote_volume_count = 8;
  253. }
  254. message DataNodeInfo {
  255. string id = 1;
  256. map<string, DiskInfo> diskInfos = 2;
  257. uint32 grpc_port = 3;
  258. }
  259. message RackInfo {
  260. string id = 1;
  261. repeated DataNodeInfo data_node_infos = 2;
  262. map<string, DiskInfo> diskInfos = 3;
  263. }
  264. message DataCenterInfo {
  265. string id = 1;
  266. repeated RackInfo rack_infos = 2;
  267. map<string, DiskInfo> diskInfos = 3;
  268. }
  269. message TopologyInfo {
  270. string id = 1;
  271. repeated DataCenterInfo data_center_infos = 2;
  272. map<string, DiskInfo> diskInfos = 3;
  273. }
  274. message VolumeListRequest {
  275. }
  276. message VolumeListResponse {
  277. TopologyInfo topology_info = 1;
  278. uint64 volume_size_limit_mb = 2;
  279. }
  280. message LookupEcVolumeRequest {
  281. uint32 volume_id = 1;
  282. }
  283. message LookupEcVolumeResponse {
  284. uint32 volume_id = 1;
  285. message EcShardIdLocation {
  286. uint32 shard_id = 1;
  287. repeated Location locations = 2;
  288. }
  289. repeated EcShardIdLocation shard_id_locations = 2;
  290. }
  291. message VacuumVolumeRequest {
  292. float garbage_threshold = 1;
  293. uint32 volume_id = 2;
  294. string collection = 3;
  295. }
  296. message VacuumVolumeResponse {
  297. }
  298. message DisableVacuumRequest {
  299. }
  300. message DisableVacuumResponse {
  301. }
  302. message EnableVacuumRequest {
  303. }
  304. message EnableVacuumResponse {
  305. }
  306. message VolumeMarkReadonlyRequest {
  307. string ip = 1;
  308. uint32 port = 2;
  309. uint32 volume_id = 4;
  310. string collection = 5;
  311. uint32 replica_placement = 6;
  312. uint32 version = 7;
  313. uint32 ttl = 8;
  314. string disk_type = 9;
  315. bool is_readonly = 10;
  316. }
  317. message VolumeMarkReadonlyResponse {
  318. }
  319. message GetMasterConfigurationRequest {
  320. }
  321. message GetMasterConfigurationResponse {
  322. string metrics_address = 1;
  323. uint32 metrics_interval_seconds = 2;
  324. repeated StorageBackend storage_backends = 3;
  325. string default_replication = 4;
  326. string leader = 5;
  327. uint32 volume_size_limit_m_b = 6;
  328. bool volume_preallocate = 7;
  329. }
  330. message ListClusterNodesRequest {
  331. string client_type = 1;
  332. string filer_group = 2;
  333. int32 limit = 4;
  334. }
  335. message ListClusterNodesResponse {
  336. message ClusterNode {
  337. string address = 1;
  338. string version = 2;
  339. int64 created_at_ns = 4;
  340. string data_center = 5;
  341. string rack = 6;
  342. }
  343. repeated ClusterNode cluster_nodes = 1;
  344. }
  345. message LeaseAdminTokenRequest {
  346. int64 previous_token = 1;
  347. int64 previous_lock_time = 2;
  348. string lock_name = 3;
  349. string client_name = 4;
  350. string message = 5;
  351. }
  352. message LeaseAdminTokenResponse {
  353. int64 token = 1;
  354. int64 lock_ts_ns = 2;
  355. }
  356. message ReleaseAdminTokenRequest {
  357. int64 previous_token = 1;
  358. int64 previous_lock_time = 2;
  359. string lock_name = 3;
  360. }
  361. message ReleaseAdminTokenResponse {
  362. }
  363. message PingRequest {
  364. string target = 1; // default to ping itself
  365. string target_type = 2;
  366. }
  367. message PingResponse {
  368. int64 start_time_ns = 1;
  369. int64 remote_time_ns = 2;
  370. int64 stop_time_ns = 3;
  371. }
  372. message RaftAddServerRequest {
  373. string id = 1;
  374. string address = 2;
  375. bool voter = 3;
  376. }
  377. message RaftAddServerResponse {
  378. }
  379. message RaftRemoveServerRequest {
  380. string id = 1;
  381. bool force = 2;
  382. }
  383. message RaftRemoveServerResponse {
  384. }
  385. message RaftListClusterServersRequest {
  386. }
  387. message RaftListClusterServersResponse {
  388. message ClusterServers {
  389. string id = 1;
  390. string address = 2;
  391. string suffrage = 3;
  392. bool isLeader = 4;
  393. }
  394. repeated ClusterServers cluster_servers = 1;
  395. }
  396. message VolumeGrowResponse {
  397. }