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.

421 lines
9.8 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 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. uint64 destroy_time = 5; // used to record the destruction time of ec volume
  114. }
  115. message StorageBackend {
  116. string type = 1;
  117. string id = 2;
  118. map<string, string> properties = 3;
  119. }
  120. message Empty {
  121. }
  122. message SuperBlockExtra {
  123. message ErasureCoding {
  124. uint32 data = 1;
  125. uint32 parity = 2;
  126. repeated uint32 volume_ids = 3;
  127. }
  128. ErasureCoding erasure_coding = 1;
  129. }
  130. message KeepConnectedRequest {
  131. string client_type = 1;
  132. string client_address = 3;
  133. string version = 4;
  134. string filer_group = 5;
  135. string data_center = 6;
  136. string rack = 7;
  137. }
  138. message VolumeLocation {
  139. string url = 1;
  140. string public_url = 2;
  141. repeated uint32 new_vids = 3;
  142. repeated uint32 deleted_vids = 4;
  143. string leader = 5; // optional when leader is not itself
  144. string data_center = 6; // optional when DataCenter is in use
  145. uint32 grpc_port = 7;
  146. repeated uint32 new_ec_vids = 8;
  147. repeated uint32 deleted_ec_vids = 9;
  148. }
  149. message ClusterNodeUpdate {
  150. string node_type = 1;
  151. string address = 2;
  152. bool is_add = 4;
  153. string filer_group = 5;
  154. int64 created_at_ns = 6;
  155. }
  156. message KeepConnectedResponse {
  157. VolumeLocation volume_location = 1;
  158. ClusterNodeUpdate cluster_node_update = 2;
  159. }
  160. message LookupVolumeRequest {
  161. repeated string volume_or_file_ids = 1;
  162. string collection = 2; // optional, a bit faster if provided.
  163. }
  164. message LookupVolumeResponse {
  165. message VolumeIdLocation {
  166. string volume_or_file_id = 1;
  167. repeated Location locations = 2;
  168. string error = 3;
  169. string auth = 4;
  170. }
  171. repeated VolumeIdLocation volume_id_locations = 1;
  172. }
  173. message Location {
  174. string url = 1;
  175. string public_url = 2;
  176. uint32 grpc_port = 3;
  177. string data_center = 4;
  178. }
  179. message AssignRequest {
  180. uint64 count = 1;
  181. string replication = 2;
  182. string collection = 3;
  183. string ttl = 4;
  184. string data_center = 5;
  185. string rack = 6;
  186. string data_node = 7;
  187. uint32 memory_map_max_size_mb = 8;
  188. uint32 Writable_volume_count = 9;
  189. string disk_type = 10;
  190. }
  191. message AssignResponse {
  192. string fid = 1;
  193. uint64 count = 4;
  194. string error = 5;
  195. string auth = 6;
  196. repeated Location replicas = 7;
  197. Location location = 8;
  198. }
  199. message StatisticsRequest {
  200. string replication = 1;
  201. string collection = 2;
  202. string ttl = 3;
  203. string disk_type = 4;
  204. }
  205. message StatisticsResponse {
  206. uint64 total_size = 4;
  207. uint64 used_size = 5;
  208. uint64 file_count = 6;
  209. }
  210. //
  211. // collection related
  212. //
  213. message Collection {
  214. string name = 1;
  215. }
  216. message CollectionListRequest {
  217. bool include_normal_volumes = 1;
  218. bool include_ec_volumes = 2;
  219. }
  220. message CollectionListResponse {
  221. repeated Collection collections = 1;
  222. }
  223. message CollectionDeleteRequest {
  224. string name = 1;
  225. }
  226. message CollectionDeleteResponse {
  227. }
  228. //
  229. // volume related
  230. //
  231. message DiskInfo {
  232. string type = 1;
  233. int64 volume_count = 2;
  234. int64 max_volume_count = 3;
  235. int64 free_volume_count = 4;
  236. int64 active_volume_count = 5;
  237. repeated VolumeInformationMessage volume_infos = 6;
  238. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  239. int64 remote_volume_count = 8;
  240. }
  241. message DataNodeInfo {
  242. string id = 1;
  243. map<string, DiskInfo> diskInfos = 2;
  244. uint32 grpc_port = 3;
  245. }
  246. message RackInfo {
  247. string id = 1;
  248. repeated DataNodeInfo data_node_infos = 2;
  249. map<string, DiskInfo> diskInfos = 3;
  250. }
  251. message DataCenterInfo {
  252. string id = 1;
  253. repeated RackInfo rack_infos = 2;
  254. map<string, DiskInfo> diskInfos = 3;
  255. }
  256. message TopologyInfo {
  257. string id = 1;
  258. repeated DataCenterInfo data_center_infos = 2;
  259. map<string, DiskInfo> diskInfos = 3;
  260. }
  261. message VolumeListRequest {
  262. }
  263. message VolumeListResponse {
  264. TopologyInfo topology_info = 1;
  265. uint64 volume_size_limit_mb = 2;
  266. }
  267. message LookupEcVolumeRequest {
  268. uint32 volume_id = 1;
  269. }
  270. message LookupEcVolumeResponse {
  271. uint32 volume_id = 1;
  272. message EcShardIdLocation {
  273. uint32 shard_id = 1;
  274. repeated Location locations = 2;
  275. }
  276. repeated EcShardIdLocation shard_id_locations = 2;
  277. }
  278. message VacuumVolumeRequest {
  279. float garbage_threshold = 1;
  280. uint32 volume_id = 2;
  281. string collection = 3;
  282. }
  283. message VacuumVolumeResponse {
  284. }
  285. message DisableVacuumRequest {
  286. }
  287. message DisableVacuumResponse {
  288. }
  289. message EnableVacuumRequest {
  290. }
  291. message EnableVacuumResponse {
  292. }
  293. message VolumeMarkReadonlyRequest {
  294. string ip = 1;
  295. uint32 port = 2;
  296. uint32 volume_id = 4;
  297. string collection = 5;
  298. uint32 replica_placement = 6;
  299. uint32 version = 7;
  300. uint32 ttl = 8;
  301. string disk_type = 9;
  302. bool is_readonly = 10;
  303. }
  304. message VolumeMarkReadonlyResponse {
  305. }
  306. message GetMasterConfigurationRequest {
  307. }
  308. message GetMasterConfigurationResponse {
  309. string metrics_address = 1;
  310. uint32 metrics_interval_seconds = 2;
  311. repeated StorageBackend storage_backends = 3;
  312. string default_replication = 4;
  313. string leader = 5;
  314. uint32 volume_size_limit_m_b = 6;
  315. bool volume_preallocate = 7;
  316. }
  317. message ListClusterNodesRequest {
  318. string client_type = 1;
  319. string filer_group = 2;
  320. int32 limit = 4;
  321. }
  322. message ListClusterNodesResponse {
  323. message ClusterNode {
  324. string address = 1;
  325. string version = 2;
  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. }