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.

515 lines
11 KiB

5 years ago
1 year ago
1 year ago
1 year ago
8 months ago
8 months ago
8 months ago
4 years ago
4 years ago
8 months ago
4 years ago
5 years ago
8 months ago
8 months ago
8 months ago
8 months ago
4 years ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
5 years ago
8 months ago
5 years ago
8 months ago
8 months ago
8 months ago
8 months ago
4 years ago
8 months ago
1 year ago
8 months ago
8 months ago
8 months ago
8 months ago
1 year ago
8 months ago
1 year ago
8 months ago
1 year ago
8 months ago
8 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 SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  39. }
  40. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  41. }
  42. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  43. }
  44. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  45. }
  46. rpc CacheRemoteObjectToLocalCluster (CacheRemoteObjectToLocalClusterRequest) returns (CacheRemoteObjectToLocalClusterResponse) {
  47. }
  48. rpc DistributedLock(LockRequest) returns (LockResponse) {
  49. }
  50. rpc DistributedUnlock(UnlockRequest) returns (UnlockResponse) {
  51. }
  52. rpc FindLockOwner(FindLockOwnerRequest) returns (FindLockOwnerResponse) {
  53. }
  54. // distributed lock management internal use only
  55. rpc TransferLocks(TransferLocksRequest) returns (TransferLocksResponse) {
  56. }
  57. }
  58. //////////////////////////////////////////////////
  59. message LookupDirectoryEntryRequest {
  60. string directory = 1;
  61. string name = 2;
  62. }
  63. message LookupDirectoryEntryResponse {
  64. Entry entry = 1;
  65. }
  66. message ListEntriesRequest {
  67. string directory = 1;
  68. string prefix = 2;
  69. string startFromFileName = 3;
  70. bool inclusiveStartFrom = 4;
  71. uint32 limit = 5;
  72. bool recursive = 6;
  73. bool delimiter = 7;
  74. }
  75. message ListEntriesResponse {
  76. Entry entry = 1;
  77. string path = 2;
  78. }
  79. message RemoteEntry {
  80. string storage_name = 1;
  81. int64 last_local_sync_ts_ns = 2;
  82. string remote_e_tag = 3;
  83. int64 remote_mtime = 4;
  84. int64 remote_size = 5;
  85. }
  86. message Entry {
  87. string name = 1;
  88. bool is_directory = 2;
  89. repeated FileChunk chunks = 3;
  90. FuseAttributes attributes = 4;
  91. map<string, bytes> extended = 5;
  92. bytes hard_link_id = 7;
  93. int32 hard_link_counter = 8; // only exists in hard link meta data
  94. bytes content = 9; // if not empty, the file content
  95. RemoteEntry remote_entry = 10;
  96. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  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 LogEntry {
  310. int64 ts_ns = 1;
  311. int32 partition_key_hash = 2;
  312. bytes data = 3;
  313. bytes key = 4;
  314. }
  315. message KeepConnectedRequest {
  316. string name = 1;
  317. uint32 grpc_port = 2;
  318. repeated string resources = 3;
  319. }
  320. message KeepConnectedResponse {
  321. }
  322. message LocateBrokerRequest {
  323. string resource = 1;
  324. }
  325. message LocateBrokerResponse {
  326. bool found = 1;
  327. // if found, send the exact address
  328. // if not found, send the full list of existing brokers
  329. message Resource {
  330. string grpc_addresses = 1;
  331. int32 resource_count = 2;
  332. }
  333. repeated Resource resources = 2;
  334. }
  335. /////////////////////////
  336. // Key-Value operations
  337. /////////////////////////
  338. message KvGetRequest {
  339. bytes key = 1;
  340. }
  341. message KvGetResponse {
  342. bytes value = 1;
  343. string error = 2;
  344. }
  345. message KvPutRequest {
  346. bytes key = 1;
  347. bytes value = 2;
  348. }
  349. message KvPutResponse {
  350. string error = 1;
  351. }
  352. /////////////////////////
  353. // path-based configurations
  354. /////////////////////////
  355. message FilerConf {
  356. int32 version = 1;
  357. message PathConf {
  358. string location_prefix = 1;
  359. string collection = 2;
  360. string replication = 3;
  361. string ttl = 4;
  362. string disk_type = 5;
  363. bool fsync = 6;
  364. uint32 volume_growth_count = 7;
  365. bool read_only = 8;
  366. string data_center = 9;
  367. string rack = 10;
  368. string data_node = 11;
  369. uint32 max_file_name_length = 12;
  370. }
  371. repeated PathConf locations = 2;
  372. }
  373. /////////////////////////
  374. // Remote Storage related
  375. /////////////////////////
  376. message CacheRemoteObjectToLocalClusterRequest {
  377. string directory = 1;
  378. string name = 2;
  379. }
  380. message CacheRemoteObjectToLocalClusterResponse {
  381. Entry entry = 1;
  382. }
  383. /////////////////////////
  384. // distributed lock management
  385. /////////////////////////
  386. message LockRequest {
  387. string name = 1;
  388. int64 seconds_to_lock = 2;
  389. string renew_token = 3;
  390. bool is_moved = 4;
  391. string owner = 5;
  392. }
  393. message LockResponse {
  394. string renew_token = 1;
  395. string lock_owner = 2;
  396. string lock_host_moved_to = 3;
  397. string error = 4;
  398. }
  399. message UnlockRequest {
  400. string name = 1;
  401. string renew_token = 2;
  402. bool is_moved = 3;
  403. }
  404. message UnlockResponse {
  405. string error = 1;
  406. string moved_to = 2;
  407. }
  408. message FindLockOwnerRequest {
  409. string name = 1;
  410. bool is_moved = 2;
  411. }
  412. message FindLockOwnerResponse {
  413. string owner = 1;
  414. }
  415. message Lock {
  416. string name = 1;
  417. string renew_token = 2;
  418. int64 expired_at_ns = 3;
  419. string owner = 4;
  420. }
  421. message TransferLocksRequest {
  422. repeated Lock locks = 1;
  423. }
  424. message TransferLocksResponse {
  425. }