master.proto 10 KB

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