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.

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