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.

439 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. bool preallocate = 7;
  85. }
  86. message VolumeInformationMessage {
  87. uint32 id = 1;
  88. uint64 size = 2;
  89. string collection = 3;
  90. uint64 file_count = 4;
  91. uint64 delete_count = 5;
  92. uint64 deleted_byte_count = 6;
  93. bool read_only = 7;
  94. uint32 replica_placement = 8;
  95. uint32 version = 9;
  96. uint32 ttl = 10;
  97. uint32 compact_revision = 11;
  98. int64 modified_at_second = 12;
  99. string remote_storage_name = 13;
  100. string remote_storage_key = 14;
  101. string disk_type = 15;
  102. }
  103. message VolumeShortInformationMessage {
  104. uint32 id = 1;
  105. string collection = 3;
  106. uint32 replica_placement = 8;
  107. uint32 version = 9;
  108. uint32 ttl = 10;
  109. string disk_type = 15;
  110. }
  111. message VolumeEcShardInformationMessage {
  112. uint32 id = 1;
  113. string collection = 2;
  114. uint32 ec_index_bits = 3;
  115. string disk_type = 4;
  116. uint64 destroy_time = 5; // used to record the destruction time of ec volume
  117. }
  118. message StorageBackend {
  119. string type = 1;
  120. string id = 2;
  121. map<string, string> properties = 3;
  122. }
  123. message Empty {
  124. }
  125. message SuperBlockExtra {
  126. message ErasureCoding {
  127. uint32 data = 1;
  128. uint32 parity = 2;
  129. repeated uint32 volume_ids = 3;
  130. }
  131. ErasureCoding erasure_coding = 1;
  132. }
  133. message KeepConnectedRequest {
  134. string client_type = 1;
  135. string client_address = 3;
  136. string version = 4;
  137. string filer_group = 5;
  138. string data_center = 6;
  139. string rack = 7;
  140. }
  141. message VolumeLocation {
  142. string url = 1;
  143. string public_url = 2;
  144. repeated uint32 new_vids = 3;
  145. repeated uint32 deleted_vids = 4;
  146. string leader = 5; // optional when leader is not itself
  147. string data_center = 6; // optional when DataCenter is in use
  148. uint32 grpc_port = 7;
  149. repeated uint32 new_ec_vids = 8;
  150. repeated uint32 deleted_ec_vids = 9;
  151. }
  152. message ClusterNodeUpdate {
  153. string node_type = 1;
  154. string address = 2;
  155. bool is_add = 4;
  156. string filer_group = 5;
  157. int64 created_at_ns = 6;
  158. }
  159. message KeepConnectedResponse {
  160. VolumeLocation volume_location = 1;
  161. ClusterNodeUpdate cluster_node_update = 2;
  162. }
  163. message LookupVolumeRequest {
  164. repeated string volume_or_file_ids = 1;
  165. string collection = 2; // optional, a bit faster if provided.
  166. }
  167. message LookupVolumeResponse {
  168. message VolumeIdLocation {
  169. string volume_or_file_id = 1;
  170. repeated Location locations = 2;
  171. string error = 3;
  172. string auth = 4;
  173. }
  174. repeated VolumeIdLocation volume_id_locations = 1;
  175. }
  176. message Location {
  177. string url = 1;
  178. string public_url = 2;
  179. uint32 grpc_port = 3;
  180. string data_center = 4;
  181. }
  182. message AssignRequest {
  183. uint64 count = 1;
  184. string replication = 2;
  185. string collection = 3;
  186. string ttl = 4;
  187. string data_center = 5;
  188. string rack = 6;
  189. string data_node = 7;
  190. uint32 memory_map_max_size_mb = 8;
  191. uint32 writable_volume_count = 9;
  192. string disk_type = 10;
  193. }
  194. message VolumeGrowRequest {
  195. uint32 writable_volume_count = 1;
  196. string replication = 2;
  197. string collection = 3;
  198. string ttl = 4;
  199. string data_center = 5;
  200. string rack = 6;
  201. string data_node = 7;
  202. uint32 memory_map_max_size_mb = 8;
  203. string disk_type = 9;
  204. }
  205. message AssignResponse {
  206. string fid = 1;
  207. uint64 count = 4;
  208. string error = 5;
  209. string auth = 6;
  210. repeated Location replicas = 7;
  211. Location location = 8;
  212. }
  213. message StatisticsRequest {
  214. string replication = 1;
  215. string collection = 2;
  216. string ttl = 3;
  217. string disk_type = 4;
  218. }
  219. message StatisticsResponse {
  220. uint64 total_size = 4;
  221. uint64 used_size = 5;
  222. uint64 file_count = 6;
  223. }
  224. //
  225. // collection related
  226. //
  227. message Collection {
  228. string name = 1;
  229. }
  230. message CollectionListRequest {
  231. bool include_normal_volumes = 1;
  232. bool include_ec_volumes = 2;
  233. }
  234. message CollectionListResponse {
  235. repeated Collection collections = 1;
  236. }
  237. message CollectionDeleteRequest {
  238. string name = 1;
  239. }
  240. message CollectionDeleteResponse {
  241. }
  242. //
  243. // volume related
  244. //
  245. message DiskInfo {
  246. string type = 1;
  247. int64 volume_count = 2;
  248. int64 max_volume_count = 3;
  249. int64 free_volume_count = 4;
  250. int64 active_volume_count = 5;
  251. repeated VolumeInformationMessage volume_infos = 6;
  252. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  253. int64 remote_volume_count = 8;
  254. }
  255. message DataNodeInfo {
  256. string id = 1;
  257. map<string, DiskInfo> diskInfos = 2;
  258. uint32 grpc_port = 3;
  259. }
  260. message RackInfo {
  261. string id = 1;
  262. repeated DataNodeInfo data_node_infos = 2;
  263. map<string, DiskInfo> diskInfos = 3;
  264. }
  265. message DataCenterInfo {
  266. string id = 1;
  267. repeated RackInfo rack_infos = 2;
  268. map<string, DiskInfo> diskInfos = 3;
  269. }
  270. message TopologyInfo {
  271. string id = 1;
  272. repeated DataCenterInfo data_center_infos = 2;
  273. map<string, DiskInfo> diskInfos = 3;
  274. }
  275. message VolumeListRequest {
  276. }
  277. message VolumeListResponse {
  278. TopologyInfo topology_info = 1;
  279. uint64 volume_size_limit_mb = 2;
  280. }
  281. message LookupEcVolumeRequest {
  282. uint32 volume_id = 1;
  283. }
  284. message LookupEcVolumeResponse {
  285. uint32 volume_id = 1;
  286. message EcShardIdLocation {
  287. uint32 shard_id = 1;
  288. repeated Location locations = 2;
  289. }
  290. repeated EcShardIdLocation shard_id_locations = 2;
  291. }
  292. message VacuumVolumeRequest {
  293. float garbage_threshold = 1;
  294. uint32 volume_id = 2;
  295. string collection = 3;
  296. }
  297. message VacuumVolumeResponse {
  298. }
  299. message DisableVacuumRequest {
  300. }
  301. message DisableVacuumResponse {
  302. }
  303. message EnableVacuumRequest {
  304. }
  305. message EnableVacuumResponse {
  306. }
  307. message VolumeMarkReadonlyRequest {
  308. string ip = 1;
  309. uint32 port = 2;
  310. uint32 volume_id = 4;
  311. string collection = 5;
  312. uint32 replica_placement = 6;
  313. uint32 version = 7;
  314. uint32 ttl = 8;
  315. string disk_type = 9;
  316. bool is_readonly = 10;
  317. }
  318. message VolumeMarkReadonlyResponse {
  319. }
  320. message GetMasterConfigurationRequest {
  321. }
  322. message GetMasterConfigurationResponse {
  323. string metrics_address = 1;
  324. uint32 metrics_interval_seconds = 2;
  325. repeated StorageBackend storage_backends = 3;
  326. string default_replication = 4;
  327. string leader = 5;
  328. uint32 volume_size_limit_m_b = 6;
  329. bool volume_preallocate = 7;
  330. }
  331. message ListClusterNodesRequest {
  332. string client_type = 1;
  333. string filer_group = 2;
  334. int32 limit = 4;
  335. }
  336. message ListClusterNodesResponse {
  337. message ClusterNode {
  338. string address = 1;
  339. string version = 2;
  340. int64 created_at_ns = 4;
  341. string data_center = 5;
  342. string rack = 6;
  343. }
  344. repeated ClusterNode cluster_nodes = 1;
  345. }
  346. message LeaseAdminTokenRequest {
  347. int64 previous_token = 1;
  348. int64 previous_lock_time = 2;
  349. string lock_name = 3;
  350. string client_name = 4;
  351. string message = 5;
  352. }
  353. message LeaseAdminTokenResponse {
  354. int64 token = 1;
  355. int64 lock_ts_ns = 2;
  356. }
  357. message ReleaseAdminTokenRequest {
  358. int64 previous_token = 1;
  359. int64 previous_lock_time = 2;
  360. string lock_name = 3;
  361. }
  362. message ReleaseAdminTokenResponse {
  363. }
  364. message PingRequest {
  365. string target = 1; // default to ping itself
  366. string target_type = 2;
  367. }
  368. message PingResponse {
  369. int64 start_time_ns = 1;
  370. int64 remote_time_ns = 2;
  371. int64 stop_time_ns = 3;
  372. }
  373. message RaftAddServerRequest {
  374. string id = 1;
  375. string address = 2;
  376. bool voter = 3;
  377. }
  378. message RaftAddServerResponse {
  379. }
  380. message RaftRemoveServerRequest {
  381. string id = 1;
  382. bool force = 2;
  383. }
  384. message RaftRemoveServerResponse {
  385. }
  386. message RaftListClusterServersRequest {
  387. }
  388. message RaftListClusterServersResponse {
  389. message ClusterServers {
  390. string id = 1;
  391. string address = 2;
  392. string suffrage = 3;
  393. bool isLeader = 4;
  394. }
  395. repeated ClusterServers cluster_servers = 1;
  396. }
  397. message VolumeGrowResponse {
  398. }