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.

383 lines
8.9 KiB

5 years ago
7 years ago
7 years ago
7 years ago
  1. syntax = "proto3";
  2. package master_pb;
  3. option go_package = "github.com/chrislusf/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. }
  127. message VolumeLocation {
  128. string url = 1;
  129. string public_url = 2;
  130. repeated uint32 new_vids = 3;
  131. repeated uint32 deleted_vids = 4;
  132. string leader = 5; // optional when leader is not itself
  133. string data_center = 6; // optional when DataCenter is in use
  134. uint32 grpc_port = 7;
  135. repeated uint32 new_ec_vids = 8;
  136. repeated uint32 deleted_ec_vids = 9;
  137. }
  138. message ClusterNodeUpdate {
  139. string node_type = 1;
  140. string address = 2;
  141. bool is_leader = 3;
  142. bool is_add = 4;
  143. string filer_group = 5;
  144. int64 created_at_ns = 6;
  145. }
  146. message KeepConnectedResponse {
  147. VolumeLocation volume_location = 1;
  148. ClusterNodeUpdate cluster_node_update = 2;
  149. }
  150. message LookupVolumeRequest {
  151. repeated string volume_or_file_ids = 1;
  152. string collection = 2; // optional, a bit faster if provided.
  153. }
  154. message LookupVolumeResponse {
  155. message VolumeIdLocation {
  156. string volume_or_file_id = 1;
  157. repeated Location locations = 2;
  158. string error = 3;
  159. string auth = 4;
  160. }
  161. repeated VolumeIdLocation volume_id_locations = 1;
  162. }
  163. message Location {
  164. string url = 1;
  165. string public_url = 2;
  166. uint32 grpc_port = 3;
  167. }
  168. message AssignRequest {
  169. uint64 count = 1;
  170. string replication = 2;
  171. string collection = 3;
  172. string ttl = 4;
  173. string data_center = 5;
  174. string rack = 6;
  175. string data_node = 7;
  176. uint32 memory_map_max_size_mb = 8;
  177. uint32 Writable_volume_count = 9;
  178. string disk_type = 10;
  179. }
  180. message AssignResponse {
  181. string fid = 1;
  182. uint64 count = 4;
  183. string error = 5;
  184. string auth = 6;
  185. repeated Location replicas = 7;
  186. Location location = 8;
  187. }
  188. message StatisticsRequest {
  189. string replication = 1;
  190. string collection = 2;
  191. string ttl = 3;
  192. string disk_type = 4;
  193. }
  194. message StatisticsResponse {
  195. uint64 total_size = 4;
  196. uint64 used_size = 5;
  197. uint64 file_count = 6;
  198. }
  199. //
  200. // collection related
  201. //
  202. message Collection {
  203. string name = 1;
  204. }
  205. message CollectionListRequest {
  206. bool include_normal_volumes = 1;
  207. bool include_ec_volumes = 2;
  208. }
  209. message CollectionListResponse {
  210. repeated Collection collections = 1;
  211. }
  212. message CollectionDeleteRequest {
  213. string name = 1;
  214. }
  215. message CollectionDeleteResponse {
  216. }
  217. //
  218. // volume related
  219. //
  220. message DiskInfo {
  221. string type = 1;
  222. int64 volume_count = 2;
  223. int64 max_volume_count = 3;
  224. int64 free_volume_count = 4;
  225. int64 active_volume_count = 5;
  226. repeated VolumeInformationMessage volume_infos = 6;
  227. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  228. int64 remote_volume_count = 8;
  229. }
  230. message DataNodeInfo {
  231. string id = 1;
  232. map<string, DiskInfo> diskInfos = 2;
  233. uint32 grpc_port = 3;
  234. }
  235. message RackInfo {
  236. string id = 1;
  237. repeated DataNodeInfo data_node_infos = 2;
  238. map<string, DiskInfo> diskInfos = 3;
  239. }
  240. message DataCenterInfo {
  241. string id = 1;
  242. repeated RackInfo rack_infos = 2;
  243. map<string, DiskInfo> diskInfos = 3;
  244. }
  245. message TopologyInfo {
  246. string id = 1;
  247. repeated DataCenterInfo data_center_infos = 2;
  248. map<string, DiskInfo> diskInfos = 3;
  249. }
  250. message VolumeListRequest {
  251. }
  252. message VolumeListResponse {
  253. TopologyInfo topology_info = 1;
  254. uint64 volume_size_limit_mb = 2;
  255. }
  256. message LookupEcVolumeRequest {
  257. uint32 volume_id = 1;
  258. }
  259. message LookupEcVolumeResponse {
  260. uint32 volume_id = 1;
  261. message EcShardIdLocation {
  262. uint32 shard_id = 1;
  263. repeated Location locations = 2;
  264. }
  265. repeated EcShardIdLocation shard_id_locations = 2;
  266. }
  267. message VacuumVolumeRequest {
  268. float garbage_threshold = 1;
  269. uint32 volume_id = 2;
  270. string collection = 3;
  271. }
  272. message VacuumVolumeResponse {
  273. }
  274. message GetMasterConfigurationRequest {
  275. }
  276. message GetMasterConfigurationResponse {
  277. string metrics_address = 1;
  278. uint32 metrics_interval_seconds = 2;
  279. repeated StorageBackend storage_backends = 3;
  280. string default_replication = 4;
  281. string leader = 5;
  282. uint32 volume_size_limit_m_b = 6;
  283. bool volume_preallocate = 7;
  284. }
  285. message ListClusterNodesRequest {
  286. string client_type = 1;
  287. string filer_group = 2;
  288. }
  289. message ListClusterNodesResponse {
  290. message ClusterNode {
  291. string address = 1;
  292. string version = 2;
  293. bool is_leader = 3;
  294. int64 created_at_ns = 4;
  295. }
  296. repeated ClusterNode cluster_nodes = 1;
  297. }
  298. message LeaseAdminTokenRequest {
  299. int64 previous_token = 1;
  300. int64 previous_lock_time = 2;
  301. string lock_name = 3;
  302. string client_name = 4;
  303. string message = 5;
  304. }
  305. message LeaseAdminTokenResponse {
  306. int64 token = 1;
  307. int64 lock_ts_ns = 2;
  308. }
  309. message ReleaseAdminTokenRequest {
  310. int64 previous_token = 1;
  311. int64 previous_lock_time = 2;
  312. string lock_name = 3;
  313. }
  314. message ReleaseAdminTokenResponse {
  315. }
  316. message PingRequest {
  317. string target = 1; // default to ping itself
  318. string target_type = 2;
  319. }
  320. message PingResponse {
  321. int64 start_time_ns = 1;
  322. int64 remote_time_ns = 2;
  323. int64 stop_time_ns = 3;
  324. }
  325. message RaftAddServerRequest {
  326. string id = 1;
  327. string address = 2;
  328. bool voter = 3;
  329. }
  330. message RaftAddServerResponse {
  331. }
  332. message RaftRemoveServerRequest {
  333. string id = 1;
  334. bool force = 2;
  335. }
  336. message RaftRemoveServerResponse {
  337. }
  338. message RaftListClusterServersRequest {
  339. }
  340. message RaftListClusterServersResponse {
  341. message ClusterServers {
  342. string id = 1;
  343. string address = 2;
  344. string suffrage = 3; //
  345. }
  346. repeated ClusterServers cluster_servers = 1;
  347. }