master.proto 9.8 KB

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