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.

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