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.

376 lines
8.2 KiB

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