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.

304 lines
6.6 KiB

5 years ago
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. bool is_chunk_manifest = 11; // content is a list of FileChunks
  89. }
  90. message FileChunkManifest {
  91. repeated FileChunk chunks = 1;
  92. }
  93. message FileId {
  94. uint32 volume_id = 1;
  95. uint64 file_key = 2;
  96. fixed32 cookie = 3;
  97. }
  98. message FuseAttributes {
  99. uint64 file_size = 1;
  100. int64 mtime = 2; // unix time in seconds
  101. uint32 file_mode = 3;
  102. uint32 uid = 4;
  103. uint32 gid = 5;
  104. int64 crtime = 6; // unix time in seconds
  105. string mime = 7;
  106. string replication = 8;
  107. string collection = 9;
  108. int32 ttl_sec = 10;
  109. string user_name = 11; // for hdfs
  110. repeated string group_name = 12; // for hdfs
  111. string symlink_target = 13;
  112. bytes md5 = 14;
  113. }
  114. message CreateEntryRequest {
  115. string directory = 1;
  116. Entry entry = 2;
  117. bool o_excl = 3;
  118. bool is_from_other_cluster = 4;
  119. }
  120. message CreateEntryResponse {
  121. string error = 1;
  122. }
  123. message UpdateEntryRequest {
  124. string directory = 1;
  125. Entry entry = 2;
  126. bool is_from_other_cluster = 3;
  127. }
  128. message UpdateEntryResponse {
  129. }
  130. message AppendToEntryRequest {
  131. string directory = 1;
  132. string entry_name = 2;
  133. repeated FileChunk chunks = 3;
  134. }
  135. message AppendToEntryResponse {
  136. }
  137. message DeleteEntryRequest {
  138. string directory = 1;
  139. string name = 2;
  140. // bool is_directory = 3;
  141. bool is_delete_data = 4;
  142. bool is_recursive = 5;
  143. bool ignore_recursive_error = 6;
  144. bool is_from_other_cluster = 7;
  145. }
  146. message DeleteEntryResponse {
  147. string error = 1;
  148. }
  149. message AtomicRenameEntryRequest {
  150. string old_directory = 1;
  151. string old_name = 2;
  152. string new_directory = 3;
  153. string new_name = 4;
  154. }
  155. message AtomicRenameEntryResponse {
  156. }
  157. message AssignVolumeRequest {
  158. int32 count = 1;
  159. string collection = 2;
  160. string replication = 3;
  161. int32 ttl_sec = 4;
  162. string data_center = 5;
  163. string parent_path = 6;
  164. }
  165. message AssignVolumeResponse {
  166. string file_id = 1;
  167. string url = 2;
  168. string public_url = 3;
  169. int32 count = 4;
  170. string auth = 5;
  171. string collection = 6;
  172. string replication = 7;
  173. string error = 8;
  174. }
  175. message LookupVolumeRequest {
  176. repeated string volume_ids = 1;
  177. }
  178. message Locations {
  179. repeated Location locations = 1;
  180. }
  181. message Location {
  182. string url = 1;
  183. string public_url = 2;
  184. }
  185. message LookupVolumeResponse {
  186. map<string, Locations> locations_map = 1;
  187. }
  188. message DeleteCollectionRequest {
  189. string collection = 1;
  190. }
  191. message DeleteCollectionResponse {
  192. }
  193. message StatisticsRequest {
  194. string replication = 1;
  195. string collection = 2;
  196. string ttl = 3;
  197. }
  198. message StatisticsResponse {
  199. string replication = 1;
  200. string collection = 2;
  201. string ttl = 3;
  202. uint64 total_size = 4;
  203. uint64 used_size = 5;
  204. uint64 file_count = 6;
  205. }
  206. message GetFilerConfigurationRequest {
  207. }
  208. message GetFilerConfigurationResponse {
  209. repeated string masters = 1;
  210. string replication = 2;
  211. string collection = 3;
  212. uint32 max_mb = 4;
  213. string dir_buckets = 5;
  214. bool cipher = 7;
  215. }
  216. message SubscribeMetadataRequest {
  217. string client_name = 1;
  218. string path_prefix = 2;
  219. int64 since_ns = 3;
  220. }
  221. message SubscribeMetadataResponse {
  222. string directory = 1;
  223. EventNotification event_notification = 2;
  224. int64 ts_ns = 3;
  225. }
  226. message LogEntry {
  227. int64 ts_ns = 1;
  228. int32 partition_key_hash = 2;
  229. bytes data = 3;
  230. }
  231. message KeepConnectedRequest {
  232. string name = 1;
  233. uint32 grpc_port = 2;
  234. repeated string resources = 3;
  235. }
  236. message KeepConnectedResponse {
  237. }
  238. message LocateBrokerRequest {
  239. string resource = 1;
  240. }
  241. message LocateBrokerResponse {
  242. bool found = 1;
  243. // if found, send the exact address
  244. // if not found, send the full list of existing brokers
  245. message Resource {
  246. string grpc_addresses = 1;
  247. int32 resource_count = 2;
  248. }
  249. repeated Resource resources = 2;
  250. }