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.

316 lines
7.8 KiB

5 years ago
7 years ago
7 years ago
7 years ago
4 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 SubscribeVolumeLocationUpdates (stream SubscribeVolumeLocationUpdatesRequest) returns (stream VolumeLocation) {
  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. }
  35. //////////////////////////////////////////////////
  36. message Heartbeat {
  37. string ip = 1;
  38. uint32 port = 2;
  39. string public_url = 3;
  40. uint64 max_file_key = 5;
  41. string data_center = 6;
  42. string rack = 7;
  43. uint32 admin_port = 8;
  44. repeated VolumeInformationMessage volumes = 9;
  45. // delta volumes
  46. repeated VolumeShortInformationMessage new_volumes = 10;
  47. repeated VolumeShortInformationMessage deleted_volumes = 11;
  48. bool has_no_volumes = 12;
  49. // erasure coding
  50. repeated VolumeEcShardInformationMessage ec_shards = 16;
  51. // delta erasure coding shards
  52. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  53. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  54. bool has_no_ec_shards = 19;
  55. map<string, uint32> max_volume_counts = 4;
  56. uint32 grpc_port = 20;
  57. }
  58. message HeartbeatResponse {
  59. uint64 volume_size_limit = 1;
  60. string leader = 2;
  61. string metrics_address = 3;
  62. uint32 metrics_interval_seconds = 4;
  63. repeated StorageBackend storage_backends = 5;
  64. }
  65. message VolumeInformationMessage {
  66. uint32 id = 1;
  67. uint64 size = 2;
  68. string collection = 3;
  69. uint64 file_count = 4;
  70. uint64 delete_count = 5;
  71. uint64 deleted_byte_count = 6;
  72. bool read_only = 7;
  73. uint32 replica_placement = 8;
  74. uint32 version = 9;
  75. uint32 ttl = 10;
  76. uint32 compact_revision = 11;
  77. int64 modified_at_second = 12;
  78. string remote_storage_name = 13;
  79. string remote_storage_key = 14;
  80. string disk_type = 15;
  81. }
  82. message VolumeShortInformationMessage {
  83. uint32 id = 1;
  84. string collection = 3;
  85. uint32 replica_placement = 8;
  86. uint32 version = 9;
  87. uint32 ttl = 10;
  88. string disk_type = 15;
  89. }
  90. message VolumeEcShardInformationMessage {
  91. uint32 id = 1;
  92. string collection = 2;
  93. uint32 ec_index_bits = 3;
  94. string disk_type = 4;
  95. }
  96. message StorageBackend {
  97. string type = 1;
  98. string id = 2;
  99. map<string, string> properties = 3;
  100. }
  101. message Empty {
  102. }
  103. message SuperBlockExtra {
  104. message ErasureCoding {
  105. uint32 data = 1;
  106. uint32 parity = 2;
  107. repeated uint32 volume_ids = 3;
  108. }
  109. ErasureCoding erasure_coding = 1;
  110. }
  111. message SubscribeVolumeLocationUpdatesRequest {
  112. string client_type = 1;
  113. string client_address = 3;
  114. string version = 4;
  115. }
  116. message VolumeLocation {
  117. string url = 1;
  118. string public_url = 2;
  119. repeated uint32 new_vids = 3;
  120. repeated uint32 deleted_vids = 4;
  121. string leader = 5; // optional when leader is not itself
  122. string data_center = 6; // optional when DataCenter is in use
  123. uint32 grpc_port = 7;
  124. }
  125. message LookupVolumeRequest {
  126. repeated string volume_or_file_ids = 1;
  127. string collection = 2; // optional, a bit faster if provided.
  128. }
  129. message LookupVolumeResponse {
  130. message VolumeIdLocation {
  131. string volume_or_file_id = 1;
  132. repeated Location locations = 2;
  133. string error = 3;
  134. string auth = 4;
  135. }
  136. repeated VolumeIdLocation volume_id_locations = 1;
  137. }
  138. message Location {
  139. string url = 1;
  140. string public_url = 2;
  141. uint32 grpc_port = 3;
  142. }
  143. message AssignRequest {
  144. uint64 count = 1;
  145. string replication = 2;
  146. string collection = 3;
  147. string ttl = 4;
  148. string data_center = 5;
  149. string rack = 6;
  150. string data_node = 7;
  151. uint32 memory_map_max_size_mb = 8;
  152. uint32 Writable_volume_count = 9;
  153. string disk_type = 10;
  154. }
  155. message AssignResponse {
  156. string fid = 1;
  157. uint64 count = 4;
  158. string error = 5;
  159. string auth = 6;
  160. repeated Location replicas = 7;
  161. Location location = 8;
  162. }
  163. message StatisticsRequest {
  164. string replication = 1;
  165. string collection = 2;
  166. string ttl = 3;
  167. string disk_type = 4;
  168. }
  169. message StatisticsResponse {
  170. uint64 total_size = 4;
  171. uint64 used_size = 5;
  172. uint64 file_count = 6;
  173. }
  174. //
  175. // collection related
  176. //
  177. message Collection {
  178. string name = 1;
  179. }
  180. message CollectionListRequest {
  181. bool include_normal_volumes = 1;
  182. bool include_ec_volumes = 2;
  183. }
  184. message CollectionListResponse {
  185. repeated Collection collections = 1;
  186. }
  187. message CollectionDeleteRequest {
  188. string name = 1;
  189. }
  190. message CollectionDeleteResponse {
  191. }
  192. //
  193. // volume related
  194. //
  195. message DiskInfo {
  196. string type = 1;
  197. int64 volume_count = 2;
  198. int64 max_volume_count = 3;
  199. int64 free_volume_count = 4;
  200. int64 active_volume_count = 5;
  201. repeated VolumeInformationMessage volume_infos = 6;
  202. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  203. int64 remote_volume_count = 8;
  204. }
  205. message DataNodeInfo {
  206. string id = 1;
  207. map<string, DiskInfo> diskInfos = 2;
  208. uint32 grpc_port = 3;
  209. }
  210. message RackInfo {
  211. string id = 1;
  212. repeated DataNodeInfo data_node_infos = 2;
  213. map<string, DiskInfo> diskInfos = 3;
  214. }
  215. message DataCenterInfo {
  216. string id = 1;
  217. repeated RackInfo rack_infos = 2;
  218. map<string, DiskInfo> diskInfos = 3;
  219. }
  220. message TopologyInfo {
  221. string id = 1;
  222. repeated DataCenterInfo data_center_infos = 2;
  223. map<string, DiskInfo> diskInfos = 3;
  224. }
  225. message VolumeListRequest {
  226. }
  227. message VolumeListResponse {
  228. TopologyInfo topology_info = 1;
  229. uint64 volume_size_limit_mb = 2;
  230. }
  231. message LookupEcVolumeRequest {
  232. uint32 volume_id = 1;
  233. }
  234. message LookupEcVolumeResponse {
  235. uint32 volume_id = 1;
  236. message EcShardIdLocation {
  237. uint32 shard_id = 1;
  238. repeated Location locations = 2;
  239. }
  240. repeated EcShardIdLocation shard_id_locations = 2;
  241. }
  242. message VacuumVolumeRequest {
  243. float garbage_threshold = 1;
  244. }
  245. message VacuumVolumeResponse {
  246. }
  247. message GetMasterConfigurationRequest {
  248. }
  249. message GetMasterConfigurationResponse {
  250. string metrics_address = 1;
  251. uint32 metrics_interval_seconds = 2;
  252. repeated StorageBackend storage_backends = 3;
  253. string default_replication = 4;
  254. string leader = 5;
  255. uint32 volume_size_limit_m_b = 6;
  256. bool volume_preallocate = 7;
  257. }
  258. message ListClusterNodesRequest {
  259. string client_type = 1;
  260. }
  261. message ListClusterNodesResponse {
  262. message ClusterNode {
  263. string address = 1;
  264. string version = 2;
  265. }
  266. repeated ClusterNode cluster_nodes = 1;
  267. }
  268. message LeaseAdminTokenRequest {
  269. int64 previous_token = 1;
  270. int64 previous_lock_time = 2;
  271. string lock_name = 3;
  272. string client_name = 4;
  273. }
  274. message LeaseAdminTokenResponse {
  275. int64 token = 1;
  276. int64 lock_ts_ns = 2;
  277. }
  278. message ReleaseAdminTokenRequest {
  279. int64 previous_token = 1;
  280. int64 previous_lock_time = 2;
  281. string lock_name = 3;
  282. }
  283. message ReleaseAdminTokenResponse {
  284. }