filer.proto 8.0 KB

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