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.

308 lines
7.6 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 KeepConnected (stream KeepConnectedRequest) 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 ListMasterClients (ListMasterClientsRequest) returns (ListMasterClientsResponse) {
  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. uint32 max_volume_count = 4;
  41. uint64 max_file_key = 5;
  42. string data_center = 6;
  43. string rack = 7;
  44. uint32 admin_port = 8;
  45. repeated VolumeInformationMessage volumes = 9;
  46. // delta volumes
  47. repeated VolumeShortInformationMessage new_volumes = 10;
  48. repeated VolumeShortInformationMessage deleted_volumes = 11;
  49. bool has_no_volumes = 12;
  50. // erasure coding
  51. repeated VolumeEcShardInformationMessage ec_shards = 16;
  52. // delta erasure coding shards
  53. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  54. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  55. bool has_no_ec_shards = 19;
  56. }
  57. message HeartbeatResponse {
  58. uint64 volume_size_limit = 1;
  59. string leader = 2;
  60. string metrics_address = 3;
  61. uint32 metrics_interval_seconds = 4;
  62. repeated StorageBackend storage_backends = 5;
  63. }
  64. message VolumeInformationMessage {
  65. uint32 id = 1;
  66. uint64 size = 2;
  67. string collection = 3;
  68. uint64 file_count = 4;
  69. uint64 delete_count = 5;
  70. uint64 deleted_byte_count = 6;
  71. bool read_only = 7;
  72. uint32 replica_placement = 8;
  73. uint32 version = 9;
  74. uint32 ttl = 10;
  75. uint32 compact_revision = 11;
  76. int64 modified_at_second = 12;
  77. string remote_storage_name = 13;
  78. string remote_storage_key = 14;
  79. }
  80. message VolumeShortInformationMessage {
  81. uint32 id = 1;
  82. string collection = 3;
  83. uint32 replica_placement = 8;
  84. uint32 version = 9;
  85. uint32 ttl = 10;
  86. }
  87. message VolumeEcShardInformationMessage {
  88. uint32 id = 1;
  89. string collection = 2;
  90. uint32 ec_index_bits = 3;
  91. }
  92. message StorageBackend {
  93. string type = 1;
  94. string id = 2;
  95. map<string, string> properties = 3;
  96. }
  97. message Empty {
  98. }
  99. message SuperBlockExtra {
  100. message ErasureCoding {
  101. uint32 data = 1;
  102. uint32 parity = 2;
  103. repeated uint32 volume_ids = 3;
  104. }
  105. ErasureCoding erasure_coding = 1;
  106. }
  107. message KeepConnectedRequest {
  108. string name = 1;
  109. uint32 grpc_port = 2;
  110. }
  111. message VolumeLocation {
  112. string url = 1;
  113. string public_url = 2;
  114. repeated uint32 new_vids = 3;
  115. repeated uint32 deleted_vids = 4;
  116. string leader = 5; // optional when leader is not itself
  117. string data_center = 6; // optional when DataCenter is in use
  118. }
  119. message LookupVolumeRequest {
  120. repeated string volume_ids = 1;
  121. string collection = 2; // optional, a bit faster if provided.
  122. }
  123. message LookupVolumeResponse {
  124. message VolumeIdLocation {
  125. string volume_id = 1;
  126. repeated Location locations = 2;
  127. string error = 3;
  128. }
  129. repeated VolumeIdLocation volume_id_locations = 1;
  130. }
  131. message Location {
  132. string url = 1;
  133. string public_url = 2;
  134. }
  135. message AssignRequest {
  136. uint64 count = 1;
  137. string replication = 2;
  138. string collection = 3;
  139. string ttl = 4;
  140. string data_center = 5;
  141. string rack = 6;
  142. string data_node = 7;
  143. uint32 memory_map_max_size_mb = 8;
  144. uint32 Writable_volume_count = 9;
  145. }
  146. message AssignResponse {
  147. string fid = 1;
  148. string url = 2;
  149. string public_url = 3;
  150. uint64 count = 4;
  151. string error = 5;
  152. string auth = 6;
  153. }
  154. message StatisticsRequest {
  155. string replication = 1;
  156. string collection = 2;
  157. string ttl = 3;
  158. }
  159. message StatisticsResponse {
  160. string replication = 1;
  161. string collection = 2;
  162. string ttl = 3;
  163. uint64 total_size = 4;
  164. uint64 used_size = 5;
  165. uint64 file_count = 6;
  166. }
  167. //
  168. // collection related
  169. //
  170. message Collection {
  171. string name = 1;
  172. }
  173. message CollectionListRequest {
  174. bool include_normal_volumes = 1;
  175. bool include_ec_volumes = 2;
  176. }
  177. message CollectionListResponse {
  178. repeated Collection collections = 1;
  179. }
  180. message CollectionDeleteRequest {
  181. string name = 1;
  182. }
  183. message CollectionDeleteResponse {
  184. }
  185. //
  186. // volume related
  187. //
  188. message DataNodeInfo {
  189. string id = 1;
  190. uint64 volume_count = 2;
  191. uint64 max_volume_count = 3;
  192. uint64 free_volume_count = 4;
  193. uint64 active_volume_count = 5;
  194. repeated VolumeInformationMessage volume_infos = 6;
  195. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  196. uint64 remote_volume_count = 8;
  197. }
  198. message RackInfo {
  199. string id = 1;
  200. uint64 volume_count = 2;
  201. uint64 max_volume_count = 3;
  202. uint64 free_volume_count = 4;
  203. uint64 active_volume_count = 5;
  204. repeated DataNodeInfo data_node_infos = 6;
  205. uint64 remote_volume_count = 7;
  206. }
  207. message DataCenterInfo {
  208. string id = 1;
  209. uint64 volume_count = 2;
  210. uint64 max_volume_count = 3;
  211. uint64 free_volume_count = 4;
  212. uint64 active_volume_count = 5;
  213. repeated RackInfo rack_infos = 6;
  214. uint64 remote_volume_count = 7;
  215. }
  216. message TopologyInfo {
  217. string id = 1;
  218. uint64 volume_count = 2;
  219. uint64 max_volume_count = 3;
  220. uint64 free_volume_count = 4;
  221. uint64 active_volume_count = 5;
  222. repeated DataCenterInfo data_center_infos = 6;
  223. uint64 remote_volume_count = 7;
  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. }
  256. message ListMasterClientsRequest {
  257. string client_type = 1;
  258. }
  259. message ListMasterClientsResponse {
  260. repeated string grpc_addresses = 1;
  261. }
  262. message LeaseAdminTokenRequest {
  263. int64 previous_token = 1;
  264. int64 previous_lock_time = 2;
  265. string lock_name = 3;
  266. }
  267. message LeaseAdminTokenResponse {
  268. int64 token = 1;
  269. int64 lock_ts_ns = 2;
  270. }
  271. message ReleaseAdminTokenRequest {
  272. int64 previous_token = 1;
  273. int64 previous_lock_time = 2;
  274. string lock_name = 3;
  275. }
  276. message ReleaseAdminTokenResponse {
  277. }