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.

528 lines
12 KiB

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