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.

506 lines
12 KiB

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