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.

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