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.

442 lines
10 KiB

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