filer.proto 11 KB

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