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.

299 lines
6.4 KiB

5 years ago
5 years ago
5 years ago
5 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 DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  27. }
  28. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  29. }
  30. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  31. }
  32. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  33. }
  34. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  35. }
  36. rpc KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  37. }
  38. rpc LocateBroker (LocateBrokerRequest) returns (LocateBrokerResponse) {
  39. }
  40. }
  41. //////////////////////////////////////////////////
  42. message LookupDirectoryEntryRequest {
  43. string directory = 1;
  44. string name = 2;
  45. }
  46. message LookupDirectoryEntryResponse {
  47. Entry entry = 1;
  48. }
  49. message ListEntriesRequest {
  50. string directory = 1;
  51. string prefix = 2;
  52. string startFromFileName = 3;
  53. bool inclusiveStartFrom = 4;
  54. uint32 limit = 5;
  55. }
  56. message ListEntriesResponse {
  57. Entry entry = 1;
  58. }
  59. message Entry {
  60. string name = 1;
  61. bool is_directory = 2;
  62. repeated FileChunk chunks = 3;
  63. FuseAttributes attributes = 4;
  64. map<string, bytes> extended = 5;
  65. }
  66. message FullEntry {
  67. string dir = 1;
  68. Entry entry = 2;
  69. }
  70. message EventNotification {
  71. Entry old_entry = 1;
  72. Entry new_entry = 2;
  73. bool delete_chunks = 3;
  74. string new_parent_path = 4;
  75. bool is_from_other_cluster = 5;
  76. }
  77. message FileChunk {
  78. string file_id = 1; // to be deprecated
  79. int64 offset = 2;
  80. uint64 size = 3;
  81. int64 mtime = 4;
  82. string e_tag = 5;
  83. string source_file_id = 6; // to be deprecated
  84. FileId fid = 7;
  85. FileId source_fid = 8;
  86. bytes cipher_key = 9;
  87. bool is_compressed = 10;
  88. }
  89. message FileId {
  90. uint32 volume_id = 1;
  91. uint64 file_key = 2;
  92. fixed32 cookie = 3;
  93. }
  94. message FuseAttributes {
  95. uint64 file_size = 1;
  96. int64 mtime = 2; // unix time in seconds
  97. uint32 file_mode = 3;
  98. uint32 uid = 4;
  99. uint32 gid = 5;
  100. int64 crtime = 6; // unix time in seconds
  101. string mime = 7;
  102. string replication = 8;
  103. string collection = 9;
  104. int32 ttl_sec = 10;
  105. string user_name = 11; // for hdfs
  106. repeated string group_name = 12; // for hdfs
  107. string symlink_target = 13;
  108. bytes md5 = 14;
  109. }
  110. message CreateEntryRequest {
  111. string directory = 1;
  112. Entry entry = 2;
  113. bool o_excl = 3;
  114. bool is_from_other_cluster = 4;
  115. }
  116. message CreateEntryResponse {
  117. string error = 1;
  118. }
  119. message UpdateEntryRequest {
  120. string directory = 1;
  121. Entry entry = 2;
  122. bool is_from_other_cluster = 3;
  123. }
  124. message UpdateEntryResponse {
  125. }
  126. message AppendToEntryRequest {
  127. string directory = 1;
  128. string entry_name = 2;
  129. repeated FileChunk chunks = 3;
  130. }
  131. message AppendToEntryResponse {
  132. }
  133. message DeleteEntryRequest {
  134. string directory = 1;
  135. string name = 2;
  136. // bool is_directory = 3;
  137. bool is_delete_data = 4;
  138. bool is_recursive = 5;
  139. bool ignore_recursive_error = 6;
  140. bool is_from_other_cluster = 7;
  141. }
  142. message DeleteEntryResponse {
  143. string error = 1;
  144. }
  145. message AtomicRenameEntryRequest {
  146. string old_directory = 1;
  147. string old_name = 2;
  148. string new_directory = 3;
  149. string new_name = 4;
  150. }
  151. message AtomicRenameEntryResponse {
  152. }
  153. message AssignVolumeRequest {
  154. int32 count = 1;
  155. string collection = 2;
  156. string replication = 3;
  157. int32 ttl_sec = 4;
  158. string data_center = 5;
  159. string parent_path = 6;
  160. }
  161. message AssignVolumeResponse {
  162. string file_id = 1;
  163. string url = 2;
  164. string public_url = 3;
  165. int32 count = 4;
  166. string auth = 5;
  167. string collection = 6;
  168. string replication = 7;
  169. string error = 8;
  170. }
  171. message LookupVolumeRequest {
  172. repeated string volume_ids = 1;
  173. }
  174. message Locations {
  175. repeated Location locations = 1;
  176. }
  177. message Location {
  178. string url = 1;
  179. string public_url = 2;
  180. }
  181. message LookupVolumeResponse {
  182. map<string, Locations> locations_map = 1;
  183. }
  184. message DeleteCollectionRequest {
  185. string collection = 1;
  186. }
  187. message DeleteCollectionResponse {
  188. }
  189. message StatisticsRequest {
  190. string replication = 1;
  191. string collection = 2;
  192. string ttl = 3;
  193. }
  194. message StatisticsResponse {
  195. string replication = 1;
  196. string collection = 2;
  197. string ttl = 3;
  198. uint64 total_size = 4;
  199. uint64 used_size = 5;
  200. uint64 file_count = 6;
  201. }
  202. message GetFilerConfigurationRequest {
  203. }
  204. message GetFilerConfigurationResponse {
  205. repeated string masters = 1;
  206. string replication = 2;
  207. string collection = 3;
  208. uint32 max_mb = 4;
  209. string dir_buckets = 5;
  210. bool cipher = 7;
  211. }
  212. message SubscribeMetadataRequest {
  213. string client_name = 1;
  214. string path_prefix = 2;
  215. int64 since_ns = 3;
  216. }
  217. message SubscribeMetadataResponse {
  218. string directory = 1;
  219. EventNotification event_notification = 2;
  220. int64 ts_ns = 3;
  221. }
  222. message LogEntry {
  223. int64 ts_ns = 1;
  224. int32 partition_key_hash = 2;
  225. bytes data = 3;
  226. }
  227. message KeepConnectedRequest {
  228. string name = 1;
  229. uint32 grpc_port = 2;
  230. repeated string resources = 3;
  231. }
  232. message KeepConnectedResponse {
  233. }
  234. message LocateBrokerRequest {
  235. string resource = 1;
  236. }
  237. message LocateBrokerResponse {
  238. bool found = 1;
  239. // if found, send the exact address
  240. // if not found, send the full list of existing brokers
  241. message Resource {
  242. string grpc_addresses = 1;
  243. int32 resource_count = 2;
  244. }
  245. repeated Resource resources = 2;
  246. }