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.

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