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.

390 lines
9.1 KiB

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