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.

471 lines
11 KiB

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/seaweedfs/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 StreamRenameEntry (StreamRenameEntryRequest) returns (stream StreamRenameEntryResponse) {
  23. }
  24. rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
  25. }
  26. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  27. }
  28. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  29. }
  30. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  31. }
  32. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  33. }
  34. rpc Ping (PingRequest) returns (PingResponse) {
  35. }
  36. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  37. }
  38. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  39. }
  40. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  41. }
  42. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  43. }
  44. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  45. }
  46. rpc CacheRemoteObjectToLocalCluster (CacheRemoteObjectToLocalClusterRequest) returns (CacheRemoteObjectToLocalClusterResponse) {
  47. }
  48. rpc Lock(LockRequest) returns (LockResponse) {
  49. }
  50. rpc Unlock(UnlockRequest) returns (UnlockResponse) {
  51. }
  52. rpc TransferLocks(TransferLocksRequest) returns (TransferLocksResponse) {
  53. }
  54. }
  55. //////////////////////////////////////////////////
  56. message LookupDirectoryEntryRequest {
  57. string directory = 1;
  58. string name = 2;
  59. }
  60. message LookupDirectoryEntryResponse {
  61. Entry entry = 1;
  62. }
  63. message ListEntriesRequest {
  64. string directory = 1;
  65. string prefix = 2;
  66. string startFromFileName = 3;
  67. bool inclusiveStartFrom = 4;
  68. uint32 limit = 5;
  69. }
  70. message ListEntriesResponse {
  71. Entry entry = 1;
  72. }
  73. message RemoteEntry {
  74. string storage_name = 1;
  75. int64 last_local_sync_ts_ns = 2;
  76. string remote_e_tag = 3;
  77. int64 remote_mtime = 4;
  78. int64 remote_size = 5;
  79. }
  80. message Entry {
  81. string name = 1;
  82. bool is_directory = 2;
  83. repeated FileChunk chunks = 3;
  84. FuseAttributes attributes = 4;
  85. map<string, bytes> extended = 5;
  86. bytes hard_link_id = 7;
  87. int32 hard_link_counter = 8; // only exists in hard link meta data
  88. bytes content = 9; // if not empty, the file content
  89. RemoteEntry remote_entry = 10;
  90. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  91. }
  92. message FullEntry {
  93. string dir = 1;
  94. Entry entry = 2;
  95. }
  96. message EventNotification {
  97. Entry old_entry = 1;
  98. Entry new_entry = 2;
  99. bool delete_chunks = 3;
  100. string new_parent_path = 4;
  101. bool is_from_other_cluster = 5;
  102. repeated int32 signatures = 6;
  103. }
  104. message FileChunk {
  105. string file_id = 1; // to be deprecated
  106. int64 offset = 2;
  107. uint64 size = 3;
  108. int64 modified_ts_ns = 4;
  109. string e_tag = 5;
  110. string source_file_id = 6; // to be deprecated
  111. FileId fid = 7;
  112. FileId source_fid = 8;
  113. bytes cipher_key = 9;
  114. bool is_compressed = 10;
  115. bool is_chunk_manifest = 11; // content is a list of FileChunks
  116. }
  117. message FileChunkManifest {
  118. repeated FileChunk chunks = 1;
  119. }
  120. message FileId {
  121. uint32 volume_id = 1;
  122. uint64 file_key = 2;
  123. fixed32 cookie = 3;
  124. }
  125. message FuseAttributes {
  126. uint64 file_size = 1;
  127. int64 mtime = 2; // unix time in seconds
  128. uint32 file_mode = 3;
  129. uint32 uid = 4;
  130. uint32 gid = 5;
  131. int64 crtime = 6; // unix time in seconds
  132. string mime = 7;
  133. int32 ttl_sec = 10;
  134. string user_name = 11; // for hdfs
  135. repeated string group_name = 12; // for hdfs
  136. string symlink_target = 13;
  137. bytes md5 = 14;
  138. uint32 rdev = 16;
  139. uint64 inode = 17;
  140. }
  141. message CreateEntryRequest {
  142. string directory = 1;
  143. Entry entry = 2;
  144. bool o_excl = 3;
  145. bool is_from_other_cluster = 4;
  146. repeated int32 signatures = 5;
  147. bool skip_check_parent_directory = 6;
  148. }
  149. message CreateEntryResponse {
  150. string error = 1;
  151. }
  152. message UpdateEntryRequest {
  153. string directory = 1;
  154. Entry entry = 2;
  155. bool is_from_other_cluster = 3;
  156. repeated int32 signatures = 4;
  157. }
  158. message UpdateEntryResponse {
  159. }
  160. message AppendToEntryRequest {
  161. string directory = 1;
  162. string entry_name = 2;
  163. repeated FileChunk chunks = 3;
  164. }
  165. message AppendToEntryResponse {
  166. }
  167. message DeleteEntryRequest {
  168. string directory = 1;
  169. string name = 2;
  170. // bool is_directory = 3;
  171. bool is_delete_data = 4;
  172. bool is_recursive = 5;
  173. bool ignore_recursive_error = 6;
  174. bool is_from_other_cluster = 7;
  175. repeated int32 signatures = 8;
  176. }
  177. message DeleteEntryResponse {
  178. string error = 1;
  179. }
  180. message AtomicRenameEntryRequest {
  181. string old_directory = 1;
  182. string old_name = 2;
  183. string new_directory = 3;
  184. string new_name = 4;
  185. repeated int32 signatures = 5;
  186. }
  187. message AtomicRenameEntryResponse {
  188. }
  189. message StreamRenameEntryRequest {
  190. string old_directory = 1;
  191. string old_name = 2;
  192. string new_directory = 3;
  193. string new_name = 4;
  194. repeated int32 signatures = 5;
  195. }
  196. message StreamRenameEntryResponse {
  197. string directory = 1;
  198. EventNotification event_notification = 2;
  199. int64 ts_ns = 3;
  200. }
  201. message AssignVolumeRequest {
  202. int32 count = 1;
  203. string collection = 2;
  204. string replication = 3;
  205. int32 ttl_sec = 4;
  206. string data_center = 5;
  207. string path = 6;
  208. string rack = 7;
  209. string data_node = 9;
  210. string disk_type = 8;
  211. }
  212. message AssignVolumeResponse {
  213. string file_id = 1;
  214. int32 count = 4;
  215. string auth = 5;
  216. string collection = 6;
  217. string replication = 7;
  218. string error = 8;
  219. Location location = 9;
  220. }
  221. message LookupVolumeRequest {
  222. repeated string volume_ids = 1;
  223. }
  224. message Locations {
  225. repeated Location locations = 1;
  226. }
  227. message Location {
  228. string url = 1;
  229. string public_url = 2;
  230. uint32 grpc_port = 3;
  231. string data_center = 4;
  232. }
  233. message LookupVolumeResponse {
  234. map<string, Locations> locations_map = 1;
  235. }
  236. message Collection {
  237. string name = 1;
  238. }
  239. message CollectionListRequest {
  240. bool include_normal_volumes = 1;
  241. bool include_ec_volumes = 2;
  242. }
  243. message CollectionListResponse {
  244. repeated Collection collections = 1;
  245. }
  246. message DeleteCollectionRequest {
  247. string collection = 1;
  248. }
  249. message DeleteCollectionResponse {
  250. }
  251. message StatisticsRequest {
  252. string replication = 1;
  253. string collection = 2;
  254. string ttl = 3;
  255. string disk_type = 4;
  256. }
  257. message StatisticsResponse {
  258. uint64 total_size = 4;
  259. uint64 used_size = 5;
  260. uint64 file_count = 6;
  261. }
  262. message PingRequest {
  263. string target = 1; // default to ping itself
  264. string target_type = 2;
  265. }
  266. message PingResponse {
  267. int64 start_time_ns = 1;
  268. int64 remote_time_ns = 2;
  269. int64 stop_time_ns = 3;
  270. }
  271. message GetFilerConfigurationRequest {
  272. }
  273. message GetFilerConfigurationResponse {
  274. repeated string masters = 1;
  275. string replication = 2;
  276. string collection = 3;
  277. uint32 max_mb = 4;
  278. string dir_buckets = 5;
  279. bool cipher = 7;
  280. int32 signature = 8;
  281. string metrics_address = 9;
  282. int32 metrics_interval_sec = 10;
  283. string version = 11;
  284. string cluster_id = 12;
  285. string filer_group = 13;
  286. }
  287. message SubscribeMetadataRequest {
  288. string client_name = 1;
  289. string path_prefix = 2;
  290. int64 since_ns = 3;
  291. int32 signature = 4;
  292. repeated string path_prefixes = 6;
  293. int32 client_id = 7;
  294. int64 until_ns = 8;
  295. int32 client_epoch = 9;
  296. repeated string directories = 10; // exact directory to watch
  297. }
  298. message SubscribeMetadataResponse {
  299. string directory = 1;
  300. EventNotification event_notification = 2;
  301. int64 ts_ns = 3;
  302. }
  303. message LogEntry {
  304. int64 ts_ns = 1;
  305. int32 partition_key_hash = 2;
  306. bytes data = 3;
  307. }
  308. message KeepConnectedRequest {
  309. string name = 1;
  310. uint32 grpc_port = 2;
  311. repeated string resources = 3;
  312. }
  313. message KeepConnectedResponse {
  314. }
  315. message LocateBrokerRequest {
  316. string resource = 1;
  317. }
  318. message LocateBrokerResponse {
  319. bool found = 1;
  320. // if found, send the exact address
  321. // if not found, send the full list of existing brokers
  322. message Resource {
  323. string grpc_addresses = 1;
  324. int32 resource_count = 2;
  325. }
  326. repeated Resource resources = 2;
  327. }
  328. /////////////////////////
  329. // Key-Value operations
  330. /////////////////////////
  331. message KvGetRequest {
  332. bytes key = 1;
  333. }
  334. message KvGetResponse {
  335. bytes value = 1;
  336. string error = 2;
  337. }
  338. message KvPutRequest {
  339. bytes key = 1;
  340. bytes value = 2;
  341. }
  342. message KvPutResponse {
  343. string error = 1;
  344. }
  345. /////////////////////////
  346. // path-based configurations
  347. /////////////////////////
  348. message FilerConf {
  349. int32 version = 1;
  350. message PathConf {
  351. string location_prefix = 1;
  352. string collection = 2;
  353. string replication = 3;
  354. string ttl = 4;
  355. string disk_type = 5;
  356. bool fsync = 6;
  357. uint32 volume_growth_count = 7;
  358. bool read_only = 8;
  359. string data_center = 9;
  360. string rack = 10;
  361. string data_node = 11;
  362. }
  363. repeated PathConf locations = 2;
  364. }
  365. /////////////////////////
  366. // Remote Storage related
  367. /////////////////////////
  368. message CacheRemoteObjectToLocalClusterRequest {
  369. string directory = 1;
  370. string name = 2;
  371. }
  372. message CacheRemoteObjectToLocalClusterResponse {
  373. Entry entry = 1;
  374. }
  375. /////////////////////////
  376. // distributed lock management
  377. /////////////////////////
  378. message LockRequest {
  379. string name = 1;
  380. int64 seconds_to_lock = 2;
  381. string renew_token = 3;
  382. bool is_moved = 4;
  383. }
  384. message LockResponse {
  385. string renew_token = 1;
  386. string moved_to = 2;
  387. string error = 3;
  388. }
  389. message UnlockRequest {
  390. string name = 1;
  391. string renew_token = 2;
  392. bool is_moved = 3;
  393. }
  394. message UnlockResponse {
  395. string error = 1;
  396. string moved_to = 2;
  397. }
  398. message Lock {
  399. string name = 1;
  400. string renew_token = 2;
  401. int64 expired_at_ns = 3;
  402. }
  403. message TransferLocksRequest {
  404. repeated Lock locks = 1;
  405. }
  406. message TransferLocksResponse {
  407. }