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.

302 lines
7.3 KiB

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