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.

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