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.

412 lines
9.0 KiB

5 years ago
5 years ago
3 years ago
3 years ago
3 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
  1. syntax = "proto3";
  2. package filer_pb;
  3. option go_package = "github.com/chrislusf/seaweedfs/weed/pb/filer_pb";
  4. option java_package = "seaweedfs.client";
  5. option java_outer_classname = "FilerProto";
  6. //////////////////////////////////////////////////
  7. service SeaweedFiler {
  8. rpc LookupDirectoryEntry (LookupDirectoryEntryRequest) returns (LookupDirectoryEntryResponse) {
  9. }
  10. rpc ListEntries (ListEntriesRequest) returns (stream ListEntriesResponse) {
  11. }
  12. rpc CreateEntry (CreateEntryRequest) returns (CreateEntryResponse) {
  13. }
  14. rpc UpdateEntry (UpdateEntryRequest) returns (UpdateEntryResponse) {
  15. }
  16. rpc AppendToEntry (AppendToEntryRequest) returns (AppendToEntryResponse) {
  17. }
  18. rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
  19. }
  20. rpc AtomicRenameEntry (AtomicRenameEntryRequest) returns (AtomicRenameEntryResponse) {
  21. }
  22. rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
  23. }
  24. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  25. }
  26. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  27. }
  28. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  29. }
  30. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  31. }
  32. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  33. }
  34. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  35. }
  36. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  37. }
  38. rpc KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  39. }
  40. rpc LocateBroker (LocateBrokerRequest) returns (LocateBrokerResponse) {
  41. }
  42. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  43. }
  44. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  45. }
  46. rpc DownloadToLocal (DownloadToLocalRequest) returns (DownloadToLocalResponse) {
  47. }
  48. }
  49. //////////////////////////////////////////////////
  50. message LookupDirectoryEntryRequest {
  51. string directory = 1;
  52. string name = 2;
  53. }
  54. message LookupDirectoryEntryResponse {
  55. Entry entry = 1;
  56. }
  57. message ListEntriesRequest {
  58. string directory = 1;
  59. string prefix = 2;
  60. string startFromFileName = 3;
  61. bool inclusiveStartFrom = 4;
  62. uint32 limit = 5;
  63. }
  64. message ListEntriesResponse {
  65. Entry entry = 1;
  66. }
  67. message RemoteEntry {
  68. string storage_name = 1;
  69. int64 local_mtime = 2;
  70. string remote_e_tag = 3;
  71. int64 remote_mtime = 4;
  72. int64 remote_size = 5;
  73. }
  74. message Entry {
  75. string name = 1;
  76. bool is_directory = 2;
  77. repeated FileChunk chunks = 3;
  78. FuseAttributes attributes = 4;
  79. map<string, bytes> extended = 5;
  80. bytes hard_link_id = 7;
  81. int32 hard_link_counter = 8; // only exists in hard link meta data
  82. bytes content = 9; // if not empty, the file content
  83. RemoteEntry remote_entry = 10;
  84. }
  85. message FullEntry {
  86. string dir = 1;
  87. Entry entry = 2;
  88. }
  89. message EventNotification {
  90. Entry old_entry = 1;
  91. Entry new_entry = 2;
  92. bool delete_chunks = 3;
  93. string new_parent_path = 4;
  94. bool is_from_other_cluster = 5;
  95. repeated int32 signatures = 6;
  96. }
  97. message FileChunk {
  98. string file_id = 1; // to be deprecated
  99. int64 offset = 2;
  100. uint64 size = 3;
  101. int64 mtime = 4;
  102. string e_tag = 5;
  103. string source_file_id = 6; // to be deprecated
  104. FileId fid = 7;
  105. FileId source_fid = 8;
  106. bytes cipher_key = 9;
  107. bool is_compressed = 10;
  108. bool is_chunk_manifest = 11; // content is a list of FileChunks
  109. }
  110. message FileChunkManifest {
  111. repeated FileChunk chunks = 1;
  112. }
  113. message FileId {
  114. uint32 volume_id = 1;
  115. uint64 file_key = 2;
  116. fixed32 cookie = 3;
  117. }
  118. message FuseAttributes {
  119. uint64 file_size = 1;
  120. int64 mtime = 2; // unix time in seconds
  121. uint32 file_mode = 3;
  122. uint32 uid = 4;
  123. uint32 gid = 5;
  124. int64 crtime = 6; // unix time in seconds
  125. string mime = 7;
  126. string replication = 8;
  127. string collection = 9;
  128. int32 ttl_sec = 10;
  129. string user_name = 11; // for hdfs
  130. repeated string group_name = 12; // for hdfs
  131. string symlink_target = 13;
  132. bytes md5 = 14;
  133. string disk_type = 15;
  134. }
  135. message CreateEntryRequest {
  136. string directory = 1;
  137. Entry entry = 2;
  138. bool o_excl = 3;
  139. bool is_from_other_cluster = 4;
  140. repeated int32 signatures = 5;
  141. }
  142. message CreateEntryResponse {
  143. string error = 1;
  144. }
  145. message UpdateEntryRequest {
  146. string directory = 1;
  147. Entry entry = 2;
  148. bool is_from_other_cluster = 3;
  149. repeated int32 signatures = 4;
  150. }
  151. message UpdateEntryResponse {
  152. }
  153. message AppendToEntryRequest {
  154. string directory = 1;
  155. string entry_name = 2;
  156. repeated FileChunk chunks = 3;
  157. }
  158. message AppendToEntryResponse {
  159. }
  160. message DeleteEntryRequest {
  161. string directory = 1;
  162. string name = 2;
  163. // bool is_directory = 3;
  164. bool is_delete_data = 4;
  165. bool is_recursive = 5;
  166. bool ignore_recursive_error = 6;
  167. bool is_from_other_cluster = 7;
  168. repeated int32 signatures = 8;
  169. }
  170. message DeleteEntryResponse {
  171. string error = 1;
  172. }
  173. message AtomicRenameEntryRequest {
  174. string old_directory = 1;
  175. string old_name = 2;
  176. string new_directory = 3;
  177. string new_name = 4;
  178. repeated int32 signatures = 5;
  179. }
  180. message AtomicRenameEntryResponse {
  181. }
  182. message AssignVolumeRequest {
  183. int32 count = 1;
  184. string collection = 2;
  185. string replication = 3;
  186. int32 ttl_sec = 4;
  187. string data_center = 5;
  188. string path = 6;
  189. string rack = 7;
  190. string disk_type = 8;
  191. }
  192. message AssignVolumeResponse {
  193. string file_id = 1;
  194. string url = 2;
  195. string public_url = 3;
  196. int32 count = 4;
  197. string auth = 5;
  198. string collection = 6;
  199. string replication = 7;
  200. string error = 8;
  201. }
  202. message LookupVolumeRequest {
  203. repeated string volume_ids = 1;
  204. }
  205. message Locations {
  206. repeated Location locations = 1;
  207. }
  208. message Location {
  209. string url = 1;
  210. string public_url = 2;
  211. }
  212. message LookupVolumeResponse {
  213. map<string, Locations> locations_map = 1;
  214. }
  215. message Collection {
  216. string name = 1;
  217. }
  218. message CollectionListRequest {
  219. bool include_normal_volumes = 1;
  220. bool include_ec_volumes = 2;
  221. }
  222. message CollectionListResponse {
  223. repeated Collection collections = 1;
  224. }
  225. message DeleteCollectionRequest {
  226. string collection = 1;
  227. }
  228. message DeleteCollectionResponse {
  229. }
  230. message StatisticsRequest {
  231. string replication = 1;
  232. string collection = 2;
  233. string ttl = 3;
  234. string disk_type = 4;
  235. }
  236. message StatisticsResponse {
  237. uint64 total_size = 4;
  238. uint64 used_size = 5;
  239. uint64 file_count = 6;
  240. }
  241. message GetFilerConfigurationRequest {
  242. }
  243. message GetFilerConfigurationResponse {
  244. repeated string masters = 1;
  245. string replication = 2;
  246. string collection = 3;
  247. uint32 max_mb = 4;
  248. string dir_buckets = 5;
  249. bool cipher = 7;
  250. int32 signature = 8;
  251. string metrics_address = 9;
  252. int32 metrics_interval_sec = 10;
  253. string version = 11;
  254. }
  255. message SubscribeMetadataRequest {
  256. string client_name = 1;
  257. string path_prefix = 2;
  258. int64 since_ns = 3;
  259. int32 signature = 4;
  260. }
  261. message SubscribeMetadataResponse {
  262. string directory = 1;
  263. EventNotification event_notification = 2;
  264. int64 ts_ns = 3;
  265. }
  266. message LogEntry {
  267. int64 ts_ns = 1;
  268. int32 partition_key_hash = 2;
  269. bytes data = 3;
  270. }
  271. message KeepConnectedRequest {
  272. string name = 1;
  273. uint32 grpc_port = 2;
  274. repeated string resources = 3;
  275. }
  276. message KeepConnectedResponse {
  277. }
  278. message LocateBrokerRequest {
  279. string resource = 1;
  280. }
  281. message LocateBrokerResponse {
  282. bool found = 1;
  283. // if found, send the exact address
  284. // if not found, send the full list of existing brokers
  285. message Resource {
  286. string grpc_addresses = 1;
  287. int32 resource_count = 2;
  288. }
  289. repeated Resource resources = 2;
  290. }
  291. /////////////////////////
  292. // Key-Value operations
  293. /////////////////////////
  294. message KvGetRequest {
  295. bytes key = 1;
  296. }
  297. message KvGetResponse {
  298. bytes value = 1;
  299. string error = 2;
  300. }
  301. message KvPutRequest {
  302. bytes key = 1;
  303. bytes value = 2;
  304. }
  305. message KvPutResponse {
  306. string error = 1;
  307. }
  308. /////////////////////////
  309. // path-based configurations
  310. /////////////////////////
  311. message FilerConf {
  312. int32 version = 1;
  313. message PathConf {
  314. string location_prefix = 1;
  315. string collection = 2;
  316. string replication = 3;
  317. string ttl = 4;
  318. string disk_type = 5;
  319. bool fsync = 6;
  320. uint32 volume_growth_count = 7;
  321. bool read_only = 8;
  322. }
  323. repeated PathConf locations = 2;
  324. }
  325. /////////////////////////
  326. // Remote Storage related
  327. /////////////////////////
  328. message RemoteConf {
  329. string type = 1;
  330. string name = 2;
  331. string s3_access_key = 4;
  332. string s3_secret_key = 5;
  333. string s3_region = 6;
  334. string s3_endpoint = 7;
  335. }
  336. message RemoteStorageMapping {
  337. map<string,RemoteStorageLocation> mappings = 1;
  338. }
  339. message RemoteStorageLocation {
  340. string name = 1;
  341. string bucket = 2;
  342. string path = 3;
  343. }
  344. message DownloadToLocalRequest {
  345. string directory = 1;
  346. string name = 2;
  347. }
  348. message DownloadToLocalResponse {
  349. Entry entry = 1;
  350. }