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.

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