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.

434 lines
9.8 KiB

5 years ago
5 years 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. syntax = "proto3";
  2. package filer_pb;
  3. option go_package = "github.com/chrislusf/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 KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  43. }
  44. rpc LocateBroker (LocateBrokerRequest) returns (LocateBrokerResponse) {
  45. }
  46. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  47. }
  48. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  49. }
  50. rpc CacheRemoteObjectToLocalCluster (CacheRemoteObjectToLocalClusterRequest) returns (CacheRemoteObjectToLocalClusterResponse) {
  51. }
  52. }
  53. //////////////////////////////////////////////////
  54. message LookupDirectoryEntryRequest {
  55. string directory = 1;
  56. string name = 2;
  57. }
  58. message LookupDirectoryEntryResponse {
  59. Entry entry = 1;
  60. }
  61. message ListEntriesRequest {
  62. string directory = 1;
  63. string prefix = 2;
  64. string startFromFileName = 3;
  65. bool inclusiveStartFrom = 4;
  66. uint32 limit = 5;
  67. }
  68. message ListEntriesResponse {
  69. Entry entry = 1;
  70. }
  71. message RemoteEntry {
  72. string storage_name = 1;
  73. int64 last_local_sync_ts_ns = 2;
  74. string remote_e_tag = 3;
  75. int64 remote_mtime = 4;
  76. int64 remote_size = 5;
  77. }
  78. message Entry {
  79. string name = 1;
  80. bool is_directory = 2;
  81. repeated FileChunk chunks = 3;
  82. FuseAttributes attributes = 4;
  83. map<string, bytes> extended = 5;
  84. bytes hard_link_id = 7;
  85. int32 hard_link_counter = 8; // only exists in hard link meta data
  86. bytes content = 9; // if not empty, the file content
  87. RemoteEntry remote_entry = 10;
  88. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  89. }
  90. message FullEntry {
  91. string dir = 1;
  92. Entry entry = 2;
  93. }
  94. message EventNotification {
  95. Entry old_entry = 1;
  96. Entry new_entry = 2;
  97. bool delete_chunks = 3;
  98. string new_parent_path = 4;
  99. bool is_from_other_cluster = 5;
  100. repeated int32 signatures = 6;
  101. }
  102. message FileChunk {
  103. string file_id = 1; // to be deprecated
  104. int64 offset = 2;
  105. uint64 size = 3;
  106. int64 mtime = 4;
  107. string e_tag = 5;
  108. string source_file_id = 6; // to be deprecated
  109. FileId fid = 7;
  110. FileId source_fid = 8;
  111. bytes cipher_key = 9;
  112. bool is_compressed = 10;
  113. bool is_chunk_manifest = 11; // content is a list of FileChunks
  114. }
  115. message FileChunkManifest {
  116. repeated FileChunk chunks = 1;
  117. }
  118. message FileId {
  119. uint32 volume_id = 1;
  120. uint64 file_key = 2;
  121. fixed32 cookie = 3;
  122. }
  123. message FuseAttributes {
  124. uint64 file_size = 1;
  125. int64 mtime = 2; // unix time in seconds
  126. uint32 file_mode = 3;
  127. uint32 uid = 4;
  128. uint32 gid = 5;
  129. int64 crtime = 6; // unix time in seconds
  130. string mime = 7;
  131. string replication = 8;
  132. string collection = 9;
  133. int32 ttl_sec = 10;
  134. string user_name = 11; // for hdfs
  135. repeated string group_name = 12; // for hdfs
  136. string symlink_target = 13;
  137. bytes md5 = 14;
  138. string disk_type = 15;
  139. uint32 rdev = 16;
  140. uint64 inode = 17;
  141. }
  142. message CreateEntryRequest {
  143. string directory = 1;
  144. Entry entry = 2;
  145. bool o_excl = 3;
  146. bool is_from_other_cluster = 4;
  147. repeated int32 signatures = 5;
  148. bool skip_check_parent_directory = 6;
  149. }
  150. message CreateEntryResponse {
  151. string error = 1;
  152. }
  153. message UpdateEntryRequest {
  154. string directory = 1;
  155. Entry entry = 2;
  156. bool is_from_other_cluster = 3;
  157. repeated int32 signatures = 4;
  158. }
  159. message UpdateEntryResponse {
  160. }
  161. message AppendToEntryRequest {
  162. string directory = 1;
  163. string entry_name = 2;
  164. repeated FileChunk chunks = 3;
  165. }
  166. message AppendToEntryResponse {
  167. }
  168. message DeleteEntryRequest {
  169. string directory = 1;
  170. string name = 2;
  171. // bool is_directory = 3;
  172. bool is_delete_data = 4;
  173. bool is_recursive = 5;
  174. bool ignore_recursive_error = 6;
  175. bool is_from_other_cluster = 7;
  176. repeated int32 signatures = 8;
  177. }
  178. message DeleteEntryResponse {
  179. string error = 1;
  180. }
  181. message AtomicRenameEntryRequest {
  182. string old_directory = 1;
  183. string old_name = 2;
  184. string new_directory = 3;
  185. string new_name = 4;
  186. repeated int32 signatures = 5;
  187. }
  188. message AtomicRenameEntryResponse {
  189. }
  190. message StreamRenameEntryRequest {
  191. string old_directory = 1;
  192. string old_name = 2;
  193. string new_directory = 3;
  194. string new_name = 4;
  195. repeated int32 signatures = 5;
  196. }
  197. message StreamRenameEntryResponse {
  198. string directory = 1;
  199. EventNotification event_notification = 2;
  200. int64 ts_ns = 3;
  201. }
  202. message AssignVolumeRequest {
  203. int32 count = 1;
  204. string collection = 2;
  205. string replication = 3;
  206. int32 ttl_sec = 4;
  207. string data_center = 5;
  208. string path = 6;
  209. string rack = 7;
  210. string data_node = 9;
  211. string disk_type = 8;
  212. }
  213. message AssignVolumeResponse {
  214. string file_id = 1;
  215. int32 count = 4;
  216. string auth = 5;
  217. string collection = 6;
  218. string replication = 7;
  219. string error = 8;
  220. Location location = 9;
  221. }
  222. message LookupVolumeRequest {
  223. repeated string volume_ids = 1;
  224. }
  225. message Locations {
  226. repeated Location locations = 1;
  227. }
  228. message Location {
  229. string url = 1;
  230. string public_url = 2;
  231. uint32 grpc_port = 3;
  232. }
  233. message LookupVolumeResponse {
  234. map<string, Locations> locations_map = 1;
  235. }
  236. message Collection {
  237. string name = 1;
  238. }
  239. message CollectionListRequest {
  240. bool include_normal_volumes = 1;
  241. bool include_ec_volumes = 2;
  242. }
  243. message CollectionListResponse {
  244. repeated Collection collections = 1;
  245. }
  246. message DeleteCollectionRequest {
  247. string collection = 1;
  248. }
  249. message DeleteCollectionResponse {
  250. }
  251. message StatisticsRequest {
  252. string replication = 1;
  253. string collection = 2;
  254. string ttl = 3;
  255. string disk_type = 4;
  256. }
  257. message StatisticsResponse {
  258. uint64 total_size = 4;
  259. uint64 used_size = 5;
  260. uint64 file_count = 6;
  261. }
  262. message PingRequest {
  263. string target = 1; // default to ping itself
  264. string target_type = 2;
  265. }
  266. message PingResponse {
  267. int64 start_time_ns = 1;
  268. int64 remote_time_ns = 2;
  269. int64 stop_time_ns = 3;
  270. }
  271. message GetFilerConfigurationRequest {
  272. }
  273. message GetFilerConfigurationResponse {
  274. repeated string masters = 1;
  275. string replication = 2;
  276. string collection = 3;
  277. uint32 max_mb = 4;
  278. string dir_buckets = 5;
  279. bool cipher = 7;
  280. int32 signature = 8;
  281. string metrics_address = 9;
  282. int32 metrics_interval_sec = 10;
  283. string version = 11;
  284. string cluster_id = 12;
  285. }
  286. message SubscribeMetadataRequest {
  287. string client_name = 1;
  288. string path_prefix = 2;
  289. int64 since_ns = 3;
  290. int32 signature = 4;
  291. repeated string path_prefixes = 6;
  292. int32 client_id = 7;
  293. }
  294. message SubscribeMetadataResponse {
  295. string directory = 1;
  296. EventNotification event_notification = 2;
  297. int64 ts_ns = 3;
  298. }
  299. message LogEntry {
  300. int64 ts_ns = 1;
  301. int32 partition_key_hash = 2;
  302. bytes data = 3;
  303. }
  304. message KeepConnectedRequest {
  305. string name = 1;
  306. uint32 grpc_port = 2;
  307. repeated string resources = 3;
  308. }
  309. message KeepConnectedResponse {
  310. }
  311. message LocateBrokerRequest {
  312. string resource = 1;
  313. }
  314. message LocateBrokerResponse {
  315. bool found = 1;
  316. // if found, send the exact address
  317. // if not found, send the full list of existing brokers
  318. message Resource {
  319. string grpc_addresses = 1;
  320. int32 resource_count = 2;
  321. }
  322. repeated Resource resources = 2;
  323. }
  324. /////////////////////////
  325. // Key-Value operations
  326. /////////////////////////
  327. message KvGetRequest {
  328. bytes key = 1;
  329. }
  330. message KvGetResponse {
  331. bytes value = 1;
  332. string error = 2;
  333. }
  334. message KvPutRequest {
  335. bytes key = 1;
  336. bytes value = 2;
  337. }
  338. message KvPutResponse {
  339. string error = 1;
  340. }
  341. /////////////////////////
  342. // path-based configurations
  343. /////////////////////////
  344. message FilerConf {
  345. int32 version = 1;
  346. message PathConf {
  347. string location_prefix = 1;
  348. string collection = 2;
  349. string replication = 3;
  350. string ttl = 4;
  351. string disk_type = 5;
  352. bool fsync = 6;
  353. uint32 volume_growth_count = 7;
  354. bool read_only = 8;
  355. string data_center = 9;
  356. string rack = 10;
  357. string data_node = 11;
  358. }
  359. repeated PathConf locations = 2;
  360. }
  361. /////////////////////////
  362. // Remote Storage related
  363. /////////////////////////
  364. message CacheRemoteObjectToLocalClusterRequest {
  365. string directory = 1;
  366. string name = 2;
  367. }
  368. message CacheRemoteObjectToLocalClusterResponse {
  369. Entry entry = 1;
  370. }