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.

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