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.

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