master.proto 9.8 KB

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