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.

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