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.

499 lines
11 KiB

5 years ago
1 year ago
1 year ago
1 year 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 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. }
  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. }
  182. message DeleteEntryResponse {
  183. string error = 1;
  184. }
  185. message AtomicRenameEntryRequest {
  186. string old_directory = 1;
  187. string old_name = 2;
  188. string new_directory = 3;
  189. string new_name = 4;
  190. repeated int32 signatures = 5;
  191. }
  192. message AtomicRenameEntryResponse {
  193. }
  194. message StreamRenameEntryRequest {
  195. string old_directory = 1;
  196. string old_name = 2;
  197. string new_directory = 3;
  198. string new_name = 4;
  199. repeated int32 signatures = 5;
  200. }
  201. message StreamRenameEntryResponse {
  202. string directory = 1;
  203. EventNotification event_notification = 2;
  204. int64 ts_ns = 3;
  205. }
  206. message AssignVolumeRequest {
  207. int32 count = 1;
  208. string collection = 2;
  209. string replication = 3;
  210. int32 ttl_sec = 4;
  211. string data_center = 5;
  212. string path = 6;
  213. string rack = 7;
  214. string data_node = 9;
  215. string disk_type = 8;
  216. }
  217. message AssignVolumeResponse {
  218. string file_id = 1;
  219. int32 count = 4;
  220. string auth = 5;
  221. string collection = 6;
  222. string replication = 7;
  223. string error = 8;
  224. Location location = 9;
  225. }
  226. message LookupVolumeRequest {
  227. repeated string volume_ids = 1;
  228. }
  229. message Locations {
  230. repeated Location locations = 1;
  231. }
  232. message Location {
  233. string url = 1;
  234. string public_url = 2;
  235. uint32 grpc_port = 3;
  236. string data_center = 4;
  237. }
  238. message LookupVolumeResponse {
  239. map<string, Locations> locations_map = 1;
  240. }
  241. message Collection {
  242. string name = 1;
  243. }
  244. message CollectionListRequest {
  245. bool include_normal_volumes = 1;
  246. bool include_ec_volumes = 2;
  247. }
  248. message CollectionListResponse {
  249. repeated Collection collections = 1;
  250. }
  251. message DeleteCollectionRequest {
  252. string collection = 1;
  253. }
  254. message DeleteCollectionResponse {
  255. }
  256. message StatisticsRequest {
  257. string replication = 1;
  258. string collection = 2;
  259. string ttl = 3;
  260. string disk_type = 4;
  261. }
  262. message StatisticsResponse {
  263. uint64 total_size = 4;
  264. uint64 used_size = 5;
  265. uint64 file_count = 6;
  266. }
  267. message PingRequest {
  268. string target = 1; // default to ping itself
  269. string target_type = 2;
  270. }
  271. message PingResponse {
  272. int64 start_time_ns = 1;
  273. int64 remote_time_ns = 2;
  274. int64 stop_time_ns = 3;
  275. }
  276. message GetFilerConfigurationRequest {
  277. }
  278. message GetFilerConfigurationResponse {
  279. repeated string masters = 1;
  280. string replication = 2;
  281. string collection = 3;
  282. uint32 max_mb = 4;
  283. string dir_buckets = 5;
  284. bool cipher = 7;
  285. int32 signature = 8;
  286. string metrics_address = 9;
  287. int32 metrics_interval_sec = 10;
  288. string version = 11;
  289. string cluster_id = 12;
  290. string filer_group = 13;
  291. }
  292. message SubscribeMetadataRequest {
  293. string client_name = 1;
  294. string path_prefix = 2;
  295. int64 since_ns = 3;
  296. int32 signature = 4;
  297. repeated string path_prefixes = 6;
  298. int32 client_id = 7;
  299. int64 until_ns = 8;
  300. int32 client_epoch = 9;
  301. repeated string directories = 10; // exact directory to watch
  302. }
  303. message SubscribeMetadataResponse {
  304. string directory = 1;
  305. EventNotification event_notification = 2;
  306. int64 ts_ns = 3;
  307. }
  308. message TraverseBfsMetadataRequest {
  309. string directory = 1;
  310. repeated string excluded_prefixes = 2;
  311. }
  312. message TraverseBfsMetadataResponse {
  313. string directory = 1;
  314. Entry entry = 2;
  315. }
  316. message LogEntry {
  317. int64 ts_ns = 1;
  318. int32 partition_key_hash = 2;
  319. bytes data = 3;
  320. bytes key = 4;
  321. }
  322. message KeepConnectedRequest {
  323. string name = 1;
  324. uint32 grpc_port = 2;
  325. repeated string resources = 3;
  326. }
  327. message KeepConnectedResponse {
  328. }
  329. message LocateBrokerRequest {
  330. string resource = 1;
  331. }
  332. message LocateBrokerResponse {
  333. bool found = 1;
  334. // if found, send the exact address
  335. // if not found, send the full list of existing brokers
  336. message Resource {
  337. string grpc_addresses = 1;
  338. int32 resource_count = 2;
  339. }
  340. repeated Resource resources = 2;
  341. }
  342. /////////////////////////
  343. // Key-Value operations
  344. /////////////////////////
  345. message KvGetRequest {
  346. bytes key = 1;
  347. }
  348. message KvGetResponse {
  349. bytes value = 1;
  350. string error = 2;
  351. }
  352. message KvPutRequest {
  353. bytes key = 1;
  354. bytes value = 2;
  355. }
  356. message KvPutResponse {
  357. string error = 1;
  358. }
  359. /////////////////////////
  360. // path-based configurations
  361. /////////////////////////
  362. message FilerConf {
  363. int32 version = 1;
  364. message PathConf {
  365. string location_prefix = 1;
  366. string collection = 2;
  367. string replication = 3;
  368. string ttl = 4;
  369. string disk_type = 5;
  370. bool fsync = 6;
  371. uint32 volume_growth_count = 7;
  372. bool read_only = 8;
  373. string data_center = 9;
  374. string rack = 10;
  375. string data_node = 11;
  376. uint32 max_file_name_length = 12;
  377. bool disable_chunk_deletion = 13;
  378. }
  379. repeated PathConf locations = 2;
  380. }
  381. /////////////////////////
  382. // Remote Storage related
  383. /////////////////////////
  384. message CacheRemoteObjectToLocalClusterRequest {
  385. string directory = 1;
  386. string name = 2;
  387. }
  388. message CacheRemoteObjectToLocalClusterResponse {
  389. Entry entry = 1;
  390. }
  391. /////////////////////////
  392. // distributed lock management
  393. /////////////////////////
  394. message LockRequest {
  395. string name = 1;
  396. int64 seconds_to_lock = 2;
  397. string renew_token = 3;
  398. bool is_moved = 4;
  399. string owner = 5;
  400. }
  401. message LockResponse {
  402. string renew_token = 1;
  403. string lock_owner = 2;
  404. string lock_host_moved_to = 3;
  405. string error = 4;
  406. }
  407. message UnlockRequest {
  408. string name = 1;
  409. string renew_token = 2;
  410. bool is_moved = 3;
  411. }
  412. message UnlockResponse {
  413. string error = 1;
  414. string moved_to = 2;
  415. }
  416. message FindLockOwnerRequest {
  417. string name = 1;
  418. bool is_moved = 2;
  419. }
  420. message FindLockOwnerResponse {
  421. string owner = 1;
  422. }
  423. message Lock {
  424. string name = 1;
  425. string renew_token = 2;
  426. int64 expired_at_ns = 3;
  427. string owner = 4;
  428. }
  429. message TransferLocksRequest {
  430. repeated Lock locks = 1;
  431. }
  432. message TransferLocksResponse {
  433. }