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.

501 lines
11 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. }
  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. int32 major_version = 14;
  292. int32 minor_version = 15;
  293. }
  294. message SubscribeMetadataRequest {
  295. string client_name = 1;
  296. string path_prefix = 2;
  297. int64 since_ns = 3;
  298. int32 signature = 4;
  299. repeated string path_prefixes = 6;
  300. int32 client_id = 7;
  301. int64 until_ns = 8;
  302. int32 client_epoch = 9;
  303. repeated string directories = 10; // exact directory to watch
  304. }
  305. message SubscribeMetadataResponse {
  306. string directory = 1;
  307. EventNotification event_notification = 2;
  308. int64 ts_ns = 3;
  309. }
  310. message TraverseBfsMetadataRequest {
  311. string directory = 1;
  312. repeated string excluded_prefixes = 2;
  313. }
  314. message TraverseBfsMetadataResponse {
  315. string directory = 1;
  316. Entry entry = 2;
  317. }
  318. message LogEntry {
  319. int64 ts_ns = 1;
  320. int32 partition_key_hash = 2;
  321. bytes data = 3;
  322. bytes key = 4;
  323. }
  324. message KeepConnectedRequest {
  325. string name = 1;
  326. uint32 grpc_port = 2;
  327. repeated string resources = 3;
  328. }
  329. message KeepConnectedResponse {
  330. }
  331. message LocateBrokerRequest {
  332. string resource = 1;
  333. }
  334. message LocateBrokerResponse {
  335. bool found = 1;
  336. // if found, send the exact address
  337. // if not found, send the full list of existing brokers
  338. message Resource {
  339. string grpc_addresses = 1;
  340. int32 resource_count = 2;
  341. }
  342. repeated Resource resources = 2;
  343. }
  344. /////////////////////////
  345. // Key-Value operations
  346. /////////////////////////
  347. message KvGetRequest {
  348. bytes key = 1;
  349. }
  350. message KvGetResponse {
  351. bytes value = 1;
  352. string error = 2;
  353. }
  354. message KvPutRequest {
  355. bytes key = 1;
  356. bytes value = 2;
  357. }
  358. message KvPutResponse {
  359. string error = 1;
  360. }
  361. /////////////////////////
  362. // path-based configurations
  363. /////////////////////////
  364. message FilerConf {
  365. int32 version = 1;
  366. message PathConf {
  367. string location_prefix = 1;
  368. string collection = 2;
  369. string replication = 3;
  370. string ttl = 4;
  371. string disk_type = 5;
  372. bool fsync = 6;
  373. uint32 volume_growth_count = 7;
  374. bool read_only = 8;
  375. string data_center = 9;
  376. string rack = 10;
  377. string data_node = 11;
  378. uint32 max_file_name_length = 12;
  379. bool disable_chunk_deletion = 13;
  380. }
  381. repeated PathConf locations = 2;
  382. }
  383. /////////////////////////
  384. // Remote Storage related
  385. /////////////////////////
  386. message CacheRemoteObjectToLocalClusterRequest {
  387. string directory = 1;
  388. string name = 2;
  389. }
  390. message CacheRemoteObjectToLocalClusterResponse {
  391. Entry entry = 1;
  392. }
  393. /////////////////////////
  394. // distributed lock management
  395. /////////////////////////
  396. message LockRequest {
  397. string name = 1;
  398. int64 seconds_to_lock = 2;
  399. string renew_token = 3;
  400. bool is_moved = 4;
  401. string owner = 5;
  402. }
  403. message LockResponse {
  404. string renew_token = 1;
  405. string lock_owner = 2;
  406. string lock_host_moved_to = 3;
  407. string error = 4;
  408. }
  409. message UnlockRequest {
  410. string name = 1;
  411. string renew_token = 2;
  412. bool is_moved = 3;
  413. }
  414. message UnlockResponse {
  415. string error = 1;
  416. string moved_to = 2;
  417. }
  418. message FindLockOwnerRequest {
  419. string name = 1;
  420. bool is_moved = 2;
  421. }
  422. message FindLockOwnerResponse {
  423. string owner = 1;
  424. }
  425. message Lock {
  426. string name = 1;
  427. string renew_token = 2;
  428. int64 expired_at_ns = 3;
  429. string owner = 4;
  430. }
  431. message TransferLocksRequest {
  432. repeated Lock locks = 1;
  433. }
  434. message TransferLocksResponse {
  435. }