filer.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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. int64 worm_enforced_at_ts_ns = 12;
  97. }
  98. message FullEntry {
  99. string dir = 1;
  100. Entry entry = 2;
  101. }
  102. message EventNotification {
  103. Entry old_entry = 1;
  104. Entry new_entry = 2;
  105. bool delete_chunks = 3;
  106. string new_parent_path = 4;
  107. bool is_from_other_cluster = 5;
  108. repeated int32 signatures = 6;
  109. }
  110. enum SSEType {
  111. NONE = 0; // No server-side encryption
  112. SSE_C = 1; // Server-Side Encryption with Customer-Provided Keys
  113. SSE_KMS = 2; // Server-Side Encryption with KMS-Managed Keys
  114. SSE_S3 = 3; // Server-Side Encryption with S3-Managed Keys
  115. }
  116. message FileChunk {
  117. string file_id = 1; // to be deprecated
  118. int64 offset = 2;
  119. uint64 size = 3;
  120. int64 modified_ts_ns = 4;
  121. string e_tag = 5;
  122. string source_file_id = 6; // to be deprecated
  123. FileId fid = 7;
  124. FileId source_fid = 8;
  125. bytes cipher_key = 9;
  126. bool is_compressed = 10;
  127. bool is_chunk_manifest = 11; // content is a list of FileChunks
  128. SSEType sse_type = 12; // Server-side encryption type
  129. bytes sse_metadata = 13; // Serialized SSE metadata for this chunk (SSE-C, SSE-KMS, or SSE-S3)
  130. }
  131. message FileChunkManifest {
  132. repeated FileChunk chunks = 1;
  133. }
  134. message FileId {
  135. uint32 volume_id = 1;
  136. uint64 file_key = 2;
  137. fixed32 cookie = 3;
  138. }
  139. message FuseAttributes {
  140. uint64 file_size = 1;
  141. int64 mtime = 2; // unix time in seconds
  142. uint32 file_mode = 3;
  143. uint32 uid = 4;
  144. uint32 gid = 5;
  145. int64 crtime = 6; // unix time in seconds
  146. string mime = 7;
  147. int32 ttl_sec = 10;
  148. string user_name = 11; // for hdfs
  149. repeated string group_name = 12; // for hdfs
  150. string symlink_target = 13;
  151. bytes md5 = 14;
  152. uint32 rdev = 16;
  153. uint64 inode = 17;
  154. }
  155. message CreateEntryRequest {
  156. string directory = 1;
  157. Entry entry = 2;
  158. bool o_excl = 3;
  159. bool is_from_other_cluster = 4;
  160. repeated int32 signatures = 5;
  161. bool skip_check_parent_directory = 6;
  162. }
  163. message CreateEntryResponse {
  164. string error = 1;
  165. }
  166. message UpdateEntryRequest {
  167. string directory = 1;
  168. Entry entry = 2;
  169. bool is_from_other_cluster = 3;
  170. repeated int32 signatures = 4;
  171. }
  172. message UpdateEntryResponse {
  173. }
  174. message AppendToEntryRequest {
  175. string directory = 1;
  176. string entry_name = 2;
  177. repeated FileChunk chunks = 3;
  178. }
  179. message AppendToEntryResponse {
  180. }
  181. message DeleteEntryRequest {
  182. string directory = 1;
  183. string name = 2;
  184. // bool is_directory = 3;
  185. bool is_delete_data = 4;
  186. bool is_recursive = 5;
  187. bool ignore_recursive_error = 6;
  188. bool is_from_other_cluster = 7;
  189. repeated int32 signatures = 8;
  190. int64 if_not_modified_after = 9;
  191. }
  192. message DeleteEntryResponse {
  193. string error = 1;
  194. }
  195. message AtomicRenameEntryRequest {
  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 AtomicRenameEntryResponse {
  203. }
  204. message StreamRenameEntryRequest {
  205. string old_directory = 1;
  206. string old_name = 2;
  207. string new_directory = 3;
  208. string new_name = 4;
  209. repeated int32 signatures = 5;
  210. }
  211. message StreamRenameEntryResponse {
  212. string directory = 1;
  213. EventNotification event_notification = 2;
  214. int64 ts_ns = 3;
  215. }
  216. message AssignVolumeRequest {
  217. int32 count = 1;
  218. string collection = 2;
  219. string replication = 3;
  220. int32 ttl_sec = 4;
  221. string data_center = 5;
  222. string path = 6;
  223. string rack = 7;
  224. string data_node = 9;
  225. string disk_type = 8;
  226. }
  227. message AssignVolumeResponse {
  228. string file_id = 1;
  229. int32 count = 4;
  230. string auth = 5;
  231. string collection = 6;
  232. string replication = 7;
  233. string error = 8;
  234. Location location = 9;
  235. }
  236. message LookupVolumeRequest {
  237. repeated string volume_ids = 1;
  238. }
  239. message Locations {
  240. repeated Location locations = 1;
  241. }
  242. message Location {
  243. string url = 1;
  244. string public_url = 2;
  245. uint32 grpc_port = 3;
  246. string data_center = 4;
  247. }
  248. message LookupVolumeResponse {
  249. map<string, Locations> locations_map = 1;
  250. }
  251. message Collection {
  252. string name = 1;
  253. }
  254. message CollectionListRequest {
  255. bool include_normal_volumes = 1;
  256. bool include_ec_volumes = 2;
  257. }
  258. message CollectionListResponse {
  259. repeated Collection collections = 1;
  260. }
  261. message DeleteCollectionRequest {
  262. string collection = 1;
  263. }
  264. message DeleteCollectionResponse {
  265. }
  266. message StatisticsRequest {
  267. string replication = 1;
  268. string collection = 2;
  269. string ttl = 3;
  270. string disk_type = 4;
  271. }
  272. message StatisticsResponse {
  273. uint64 total_size = 4;
  274. uint64 used_size = 5;
  275. uint64 file_count = 6;
  276. }
  277. message PingRequest {
  278. string target = 1; // default to ping itself
  279. string target_type = 2;
  280. }
  281. message PingResponse {
  282. int64 start_time_ns = 1;
  283. int64 remote_time_ns = 2;
  284. int64 stop_time_ns = 3;
  285. }
  286. message GetFilerConfigurationRequest {
  287. }
  288. message GetFilerConfigurationResponse {
  289. repeated string masters = 1;
  290. string replication = 2;
  291. string collection = 3;
  292. uint32 max_mb = 4;
  293. string dir_buckets = 5;
  294. bool cipher = 7;
  295. int32 signature = 8;
  296. string metrics_address = 9;
  297. int32 metrics_interval_sec = 10;
  298. string version = 11;
  299. string cluster_id = 12;
  300. string filer_group = 13;
  301. int32 major_version = 14;
  302. int32 minor_version = 15;
  303. }
  304. message SubscribeMetadataRequest {
  305. string client_name = 1;
  306. string path_prefix = 2;
  307. int64 since_ns = 3;
  308. int32 signature = 4;
  309. repeated string path_prefixes = 6;
  310. int32 client_id = 7;
  311. int64 until_ns = 8;
  312. int32 client_epoch = 9;
  313. repeated string directories = 10; // exact directory to watch
  314. }
  315. message SubscribeMetadataResponse {
  316. string directory = 1;
  317. EventNotification event_notification = 2;
  318. int64 ts_ns = 3;
  319. }
  320. message TraverseBfsMetadataRequest {
  321. string directory = 1;
  322. repeated string excluded_prefixes = 2;
  323. }
  324. message TraverseBfsMetadataResponse {
  325. string directory = 1;
  326. Entry entry = 2;
  327. }
  328. message LogEntry {
  329. int64 ts_ns = 1;
  330. int32 partition_key_hash = 2;
  331. bytes data = 3;
  332. bytes key = 4;
  333. }
  334. message KeepConnectedRequest {
  335. string name = 1;
  336. uint32 grpc_port = 2;
  337. repeated string resources = 3;
  338. }
  339. message KeepConnectedResponse {
  340. }
  341. message LocateBrokerRequest {
  342. string resource = 1;
  343. }
  344. message LocateBrokerResponse {
  345. bool found = 1;
  346. // if found, send the exact address
  347. // if not found, send the full list of existing brokers
  348. message Resource {
  349. string grpc_addresses = 1;
  350. int32 resource_count = 2;
  351. }
  352. repeated Resource resources = 2;
  353. }
  354. /////////////////////////
  355. // Key-Value operations
  356. /////////////////////////
  357. message KvGetRequest {
  358. bytes key = 1;
  359. }
  360. message KvGetResponse {
  361. bytes value = 1;
  362. string error = 2;
  363. }
  364. message KvPutRequest {
  365. bytes key = 1;
  366. bytes value = 2;
  367. }
  368. message KvPutResponse {
  369. string error = 1;
  370. }
  371. /////////////////////////
  372. // path-based configurations
  373. /////////////////////////
  374. message FilerConf {
  375. int32 version = 1;
  376. message PathConf {
  377. string location_prefix = 1;
  378. string collection = 2;
  379. string replication = 3;
  380. string ttl = 4;
  381. string disk_type = 5;
  382. bool fsync = 6;
  383. uint32 volume_growth_count = 7;
  384. bool read_only = 8;
  385. string data_center = 9;
  386. string rack = 10;
  387. string data_node = 11;
  388. uint32 max_file_name_length = 12;
  389. bool disable_chunk_deletion = 13;
  390. bool worm = 14;
  391. uint64 worm_grace_period_seconds = 15;
  392. uint64 worm_retention_time_seconds = 16;
  393. }
  394. repeated PathConf locations = 2;
  395. }
  396. /////////////////////////
  397. // Remote Storage related
  398. /////////////////////////
  399. message CacheRemoteObjectToLocalClusterRequest {
  400. string directory = 1;
  401. string name = 2;
  402. }
  403. message CacheRemoteObjectToLocalClusterResponse {
  404. Entry entry = 1;
  405. }
  406. /////////////////////////
  407. // distributed lock management
  408. /////////////////////////
  409. message LockRequest {
  410. string name = 1;
  411. int64 seconds_to_lock = 2;
  412. string renew_token = 3;
  413. bool is_moved = 4;
  414. string owner = 5;
  415. }
  416. message LockResponse {
  417. string renew_token = 1;
  418. string lock_owner = 2;
  419. string lock_host_moved_to = 3;
  420. string error = 4;
  421. }
  422. message UnlockRequest {
  423. string name = 1;
  424. string renew_token = 2;
  425. bool is_moved = 3;
  426. }
  427. message UnlockResponse {
  428. string error = 1;
  429. string moved_to = 2;
  430. }
  431. message FindLockOwnerRequest {
  432. string name = 1;
  433. bool is_moved = 2;
  434. }
  435. message FindLockOwnerResponse {
  436. string owner = 1;
  437. }
  438. message Lock {
  439. string name = 1;
  440. string renew_token = 2;
  441. int64 expired_at_ns = 3;
  442. string owner = 4;
  443. }
  444. message TransferLocksRequest {
  445. repeated Lock locks = 1;
  446. }
  447. message TransferLocksResponse {
  448. }