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.

431 lines
9.7 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. }
  268. message GetFilerConfigurationRequest {
  269. }
  270. message GetFilerConfigurationResponse {
  271. repeated string masters = 1;
  272. string replication = 2;
  273. string collection = 3;
  274. uint32 max_mb = 4;
  275. string dir_buckets = 5;
  276. bool cipher = 7;
  277. int32 signature = 8;
  278. string metrics_address = 9;
  279. int32 metrics_interval_sec = 10;
  280. string version = 11;
  281. string cluster_id = 12;
  282. }
  283. message SubscribeMetadataRequest {
  284. string client_name = 1;
  285. string path_prefix = 2;
  286. int64 since_ns = 3;
  287. int32 signature = 4;
  288. repeated string path_prefixes = 6;
  289. int32 client_id = 7;
  290. }
  291. message SubscribeMetadataResponse {
  292. string directory = 1;
  293. EventNotification event_notification = 2;
  294. int64 ts_ns = 3;
  295. }
  296. message LogEntry {
  297. int64 ts_ns = 1;
  298. int32 partition_key_hash = 2;
  299. bytes data = 3;
  300. }
  301. message KeepConnectedRequest {
  302. string name = 1;
  303. uint32 grpc_port = 2;
  304. repeated string resources = 3;
  305. }
  306. message KeepConnectedResponse {
  307. }
  308. message LocateBrokerRequest {
  309. string resource = 1;
  310. }
  311. message LocateBrokerResponse {
  312. bool found = 1;
  313. // if found, send the exact address
  314. // if not found, send the full list of existing brokers
  315. message Resource {
  316. string grpc_addresses = 1;
  317. int32 resource_count = 2;
  318. }
  319. repeated Resource resources = 2;
  320. }
  321. /////////////////////////
  322. // Key-Value operations
  323. /////////////////////////
  324. message KvGetRequest {
  325. bytes key = 1;
  326. }
  327. message KvGetResponse {
  328. bytes value = 1;
  329. string error = 2;
  330. }
  331. message KvPutRequest {
  332. bytes key = 1;
  333. bytes value = 2;
  334. }
  335. message KvPutResponse {
  336. string error = 1;
  337. }
  338. /////////////////////////
  339. // path-based configurations
  340. /////////////////////////
  341. message FilerConf {
  342. int32 version = 1;
  343. message PathConf {
  344. string location_prefix = 1;
  345. string collection = 2;
  346. string replication = 3;
  347. string ttl = 4;
  348. string disk_type = 5;
  349. bool fsync = 6;
  350. uint32 volume_growth_count = 7;
  351. bool read_only = 8;
  352. string data_center = 9;
  353. string rack = 10;
  354. string data_node = 11;
  355. }
  356. repeated PathConf locations = 2;
  357. }
  358. /////////////////////////
  359. // Remote Storage related
  360. /////////////////////////
  361. message CacheRemoteObjectToLocalClusterRequest {
  362. string directory = 1;
  363. string name = 2;
  364. }
  365. message CacheRemoteObjectToLocalClusterResponse {
  366. Entry entry = 1;
  367. }