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.

418 lines
9.7 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 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_add = 4;
  150. string filer_group = 5;
  151. int64 created_at_ns = 6;
  152. }
  153. message KeepConnectedResponse {
  154. VolumeLocation volume_location = 1;
  155. ClusterNodeUpdate cluster_node_update = 2;
  156. }
  157. message LookupVolumeRequest {
  158. repeated string volume_or_file_ids = 1;
  159. string collection = 2; // optional, a bit faster if provided.
  160. }
  161. message LookupVolumeResponse {
  162. message VolumeIdLocation {
  163. string volume_or_file_id = 1;
  164. repeated Location locations = 2;
  165. string error = 3;
  166. string auth = 4;
  167. }
  168. repeated VolumeIdLocation volume_id_locations = 1;
  169. }
  170. message Location {
  171. string url = 1;
  172. string public_url = 2;
  173. uint32 grpc_port = 3;
  174. string data_center = 4;
  175. }
  176. message AssignRequest {
  177. uint64 count = 1;
  178. string replication = 2;
  179. string collection = 3;
  180. string ttl = 4;
  181. string data_center = 5;
  182. string rack = 6;
  183. string data_node = 7;
  184. uint32 memory_map_max_size_mb = 8;
  185. uint32 Writable_volume_count = 9;
  186. string disk_type = 10;
  187. }
  188. message AssignResponse {
  189. string fid = 1;
  190. uint64 count = 4;
  191. string error = 5;
  192. string auth = 6;
  193. repeated Location replicas = 7;
  194. Location location = 8;
  195. }
  196. message StatisticsRequest {
  197. string replication = 1;
  198. string collection = 2;
  199. string ttl = 3;
  200. string disk_type = 4;
  201. }
  202. message StatisticsResponse {
  203. uint64 total_size = 4;
  204. uint64 used_size = 5;
  205. uint64 file_count = 6;
  206. }
  207. //
  208. // collection related
  209. //
  210. message Collection {
  211. string name = 1;
  212. }
  213. message CollectionListRequest {
  214. bool include_normal_volumes = 1;
  215. bool include_ec_volumes = 2;
  216. }
  217. message CollectionListResponse {
  218. repeated Collection collections = 1;
  219. }
  220. message CollectionDeleteRequest {
  221. string name = 1;
  222. }
  223. message CollectionDeleteResponse {
  224. }
  225. //
  226. // volume related
  227. //
  228. message DiskInfo {
  229. string type = 1;
  230. int64 volume_count = 2;
  231. int64 max_volume_count = 3;
  232. int64 free_volume_count = 4;
  233. int64 active_volume_count = 5;
  234. repeated VolumeInformationMessage volume_infos = 6;
  235. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  236. int64 remote_volume_count = 8;
  237. }
  238. message DataNodeInfo {
  239. string id = 1;
  240. map<string, DiskInfo> diskInfos = 2;
  241. uint32 grpc_port = 3;
  242. }
  243. message RackInfo {
  244. string id = 1;
  245. repeated DataNodeInfo data_node_infos = 2;
  246. map<string, DiskInfo> diskInfos = 3;
  247. }
  248. message DataCenterInfo {
  249. string id = 1;
  250. repeated RackInfo rack_infos = 2;
  251. map<string, DiskInfo> diskInfos = 3;
  252. }
  253. message TopologyInfo {
  254. string id = 1;
  255. repeated DataCenterInfo data_center_infos = 2;
  256. map<string, DiskInfo> diskInfos = 3;
  257. }
  258. message VolumeListRequest {
  259. }
  260. message VolumeListResponse {
  261. TopologyInfo topology_info = 1;
  262. uint64 volume_size_limit_mb = 2;
  263. }
  264. message LookupEcVolumeRequest {
  265. uint32 volume_id = 1;
  266. }
  267. message LookupEcVolumeResponse {
  268. uint32 volume_id = 1;
  269. message EcShardIdLocation {
  270. uint32 shard_id = 1;
  271. repeated Location locations = 2;
  272. }
  273. repeated EcShardIdLocation shard_id_locations = 2;
  274. }
  275. message VacuumVolumeRequest {
  276. float garbage_threshold = 1;
  277. uint32 volume_id = 2;
  278. string collection = 3;
  279. }
  280. message VacuumVolumeResponse {
  281. }
  282. message DisableVacuumRequest {
  283. }
  284. message DisableVacuumResponse {
  285. }
  286. message EnableVacuumRequest {
  287. }
  288. message EnableVacuumResponse {
  289. }
  290. message VolumeMarkReadonlyRequest {
  291. string ip = 1;
  292. uint32 port = 2;
  293. uint32 volume_id = 4;
  294. string collection = 5;
  295. uint32 replica_placement = 6;
  296. uint32 version = 7;
  297. uint32 ttl = 8;
  298. string disk_type = 9;
  299. bool is_readonly = 10;
  300. }
  301. message VolumeMarkReadonlyResponse {
  302. }
  303. message GetMasterConfigurationRequest {
  304. }
  305. message GetMasterConfigurationResponse {
  306. string metrics_address = 1;
  307. uint32 metrics_interval_seconds = 2;
  308. repeated StorageBackend storage_backends = 3;
  309. string default_replication = 4;
  310. string leader = 5;
  311. uint32 volume_size_limit_m_b = 6;
  312. bool volume_preallocate = 7;
  313. }
  314. message ListClusterNodesRequest {
  315. string client_type = 1;
  316. string filer_group = 2;
  317. int32 limit = 4;
  318. }
  319. message ListClusterNodesResponse {
  320. message ClusterNode {
  321. string address = 1;
  322. string version = 2;
  323. int64 created_at_ns = 4;
  324. string data_center = 5;
  325. string rack = 6;
  326. }
  327. repeated ClusterNode cluster_nodes = 1;
  328. }
  329. message LeaseAdminTokenRequest {
  330. int64 previous_token = 1;
  331. int64 previous_lock_time = 2;
  332. string lock_name = 3;
  333. string client_name = 4;
  334. string message = 5;
  335. }
  336. message LeaseAdminTokenResponse {
  337. int64 token = 1;
  338. int64 lock_ts_ns = 2;
  339. }
  340. message ReleaseAdminTokenRequest {
  341. int64 previous_token = 1;
  342. int64 previous_lock_time = 2;
  343. string lock_name = 3;
  344. }
  345. message ReleaseAdminTokenResponse {
  346. }
  347. message PingRequest {
  348. string target = 1; // default to ping itself
  349. string target_type = 2;
  350. }
  351. message PingResponse {
  352. int64 start_time_ns = 1;
  353. int64 remote_time_ns = 2;
  354. int64 stop_time_ns = 3;
  355. }
  356. message RaftAddServerRequest {
  357. string id = 1;
  358. string address = 2;
  359. bool voter = 3;
  360. }
  361. message RaftAddServerResponse {
  362. }
  363. message RaftRemoveServerRequest {
  364. string id = 1;
  365. bool force = 2;
  366. }
  367. message RaftRemoveServerResponse {
  368. }
  369. message RaftListClusterServersRequest {
  370. }
  371. message RaftListClusterServersResponse {
  372. message ClusterServers {
  373. string id = 1;
  374. string address = 2;
  375. string suffrage = 3;
  376. bool isLeader = 4;
  377. }
  378. repeated ClusterServers cluster_servers = 1;
  379. }