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.

420 lines
9.5 KiB

5 years ago
5 years ago
3 years ago
3 years ago
3 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 StreamRenameEntry (StreamRenameEntryRequest) returns (stream StreamRenameEntryResponse) {
  23. }
  24. rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
  25. }
  26. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  27. }
  28. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  29. }
  30. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  31. }
  32. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  33. }
  34. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  35. }
  36. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  37. }
  38. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  39. }
  40. rpc KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  41. }
  42. rpc LocateBroker (LocateBrokerRequest) returns (LocateBrokerResponse) {
  43. }
  44. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  45. }
  46. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  47. }
  48. rpc CacheRemoteObjectToLocalCluster (CacheRemoteObjectToLocalClusterRequest) returns (CacheRemoteObjectToLocalClusterResponse) {
  49. }
  50. }
  51. //////////////////////////////////////////////////
  52. message LookupDirectoryEntryRequest {
  53. string directory = 1;
  54. string name = 2;
  55. }
  56. message LookupDirectoryEntryResponse {
  57. Entry entry = 1;
  58. }
  59. message ListEntriesRequest {
  60. string directory = 1;
  61. string prefix = 2;
  62. string startFromFileName = 3;
  63. bool inclusiveStartFrom = 4;
  64. uint32 limit = 5;
  65. }
  66. message ListEntriesResponse {
  67. Entry entry = 1;
  68. }
  69. message RemoteEntry {
  70. string storage_name = 1;
  71. int64 last_local_sync_ts_ns = 2;
  72. string remote_e_tag = 3;
  73. int64 remote_mtime = 4;
  74. int64 remote_size = 5;
  75. }
  76. message Entry {
  77. string name = 1;
  78. bool is_directory = 2;
  79. repeated FileChunk chunks = 3;
  80. FuseAttributes attributes = 4;
  81. map<string, bytes> extended = 5;
  82. bytes hard_link_id = 7;
  83. int32 hard_link_counter = 8; // only exists in hard link meta data
  84. bytes content = 9; // if not empty, the file content
  85. RemoteEntry remote_entry = 10;
  86. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  87. }
  88. message FullEntry {
  89. string dir = 1;
  90. Entry entry = 2;
  91. }
  92. message EventNotification {
  93. Entry old_entry = 1;
  94. Entry new_entry = 2;
  95. bool delete_chunks = 3;
  96. string new_parent_path = 4;
  97. bool is_from_other_cluster = 5;
  98. repeated int32 signatures = 6;
  99. }
  100. message FileChunk {
  101. string file_id = 1; // to be deprecated
  102. int64 offset = 2;
  103. uint64 size = 3;
  104. int64 mtime = 4;
  105. string e_tag = 5;
  106. string source_file_id = 6; // to be deprecated
  107. FileId fid = 7;
  108. FileId source_fid = 8;
  109. bytes cipher_key = 9;
  110. bool is_compressed = 10;
  111. bool is_chunk_manifest = 11; // content is a list of FileChunks
  112. }
  113. message FileChunkManifest {
  114. repeated FileChunk chunks = 1;
  115. }
  116. message FileId {
  117. uint32 volume_id = 1;
  118. uint64 file_key = 2;
  119. fixed32 cookie = 3;
  120. }
  121. message FuseAttributes {
  122. uint64 file_size = 1;
  123. int64 mtime = 2; // unix time in seconds
  124. uint32 file_mode = 3;
  125. uint32 uid = 4;
  126. uint32 gid = 5;
  127. int64 crtime = 6; // unix time in seconds
  128. string mime = 7;
  129. string replication = 8;
  130. string collection = 9;
  131. int32 ttl_sec = 10;
  132. string user_name = 11; // for hdfs
  133. repeated string group_name = 12; // for hdfs
  134. string symlink_target = 13;
  135. bytes md5 = 14;
  136. string disk_type = 15;
  137. uint32 rdev = 16;
  138. uint64 inode = 17;
  139. }
  140. message CreateEntryRequest {
  141. string directory = 1;
  142. Entry entry = 2;
  143. bool o_excl = 3;
  144. bool is_from_other_cluster = 4;
  145. repeated int32 signatures = 5;
  146. }
  147. message CreateEntryResponse {
  148. string error = 1;
  149. }
  150. message UpdateEntryRequest {
  151. string directory = 1;
  152. Entry entry = 2;
  153. bool is_from_other_cluster = 3;
  154. repeated int32 signatures = 4;
  155. }
  156. message UpdateEntryResponse {
  157. }
  158. message AppendToEntryRequest {
  159. string directory = 1;
  160. string entry_name = 2;
  161. repeated FileChunk chunks = 3;
  162. }
  163. message AppendToEntryResponse {
  164. }
  165. message DeleteEntryRequest {
  166. string directory = 1;
  167. string name = 2;
  168. // bool is_directory = 3;
  169. bool is_delete_data = 4;
  170. bool is_recursive = 5;
  171. bool ignore_recursive_error = 6;
  172. bool is_from_other_cluster = 7;
  173. repeated int32 signatures = 8;
  174. }
  175. message DeleteEntryResponse {
  176. string error = 1;
  177. }
  178. message AtomicRenameEntryRequest {
  179. string old_directory = 1;
  180. string old_name = 2;
  181. string new_directory = 3;
  182. string new_name = 4;
  183. repeated int32 signatures = 5;
  184. }
  185. message AtomicRenameEntryResponse {
  186. }
  187. message StreamRenameEntryRequest {
  188. string old_directory = 1;
  189. string old_name = 2;
  190. string new_directory = 3;
  191. string new_name = 4;
  192. repeated int32 signatures = 5;
  193. }
  194. message StreamRenameEntryResponse {
  195. string directory = 1;
  196. EventNotification event_notification = 2;
  197. int64 ts_ns = 3;
  198. }
  199. message AssignVolumeRequest {
  200. int32 count = 1;
  201. string collection = 2;
  202. string replication = 3;
  203. int32 ttl_sec = 4;
  204. string data_center = 5;
  205. string path = 6;
  206. string rack = 7;
  207. string data_node = 9;
  208. string disk_type = 8;
  209. }
  210. message AssignVolumeResponse {
  211. string file_id = 1;
  212. int32 count = 4;
  213. string auth = 5;
  214. string collection = 6;
  215. string replication = 7;
  216. string error = 8;
  217. Location location = 9;
  218. }
  219. message LookupVolumeRequest {
  220. repeated string volume_ids = 1;
  221. }
  222. message Locations {
  223. repeated Location locations = 1;
  224. }
  225. message Location {
  226. string url = 1;
  227. string public_url = 2;
  228. uint32 grpc_port = 3;
  229. }
  230. message LookupVolumeResponse {
  231. map<string, Locations> locations_map = 1;
  232. }
  233. message Collection {
  234. string name = 1;
  235. }
  236. message CollectionListRequest {
  237. bool include_normal_volumes = 1;
  238. bool include_ec_volumes = 2;
  239. }
  240. message CollectionListResponse {
  241. repeated Collection collections = 1;
  242. }
  243. message DeleteCollectionRequest {
  244. string collection = 1;
  245. }
  246. message DeleteCollectionResponse {
  247. }
  248. message StatisticsRequest {
  249. string replication = 1;
  250. string collection = 2;
  251. string ttl = 3;
  252. string disk_type = 4;
  253. }
  254. message StatisticsResponse {
  255. uint64 total_size = 4;
  256. uint64 used_size = 5;
  257. uint64 file_count = 6;
  258. }
  259. message GetFilerConfigurationRequest {
  260. }
  261. message GetFilerConfigurationResponse {
  262. repeated string masters = 1;
  263. string replication = 2;
  264. string collection = 3;
  265. uint32 max_mb = 4;
  266. string dir_buckets = 5;
  267. bool cipher = 7;
  268. int32 signature = 8;
  269. string metrics_address = 9;
  270. int32 metrics_interval_sec = 10;
  271. string version = 11;
  272. string cluster_id = 12;
  273. }
  274. message SubscribeMetadataRequest {
  275. string client_name = 1;
  276. string path_prefix = 2;
  277. int64 since_ns = 3;
  278. int32 signature = 4;
  279. repeated string path_prefixes = 6;
  280. int32 client_id = 7;
  281. }
  282. message SubscribeMetadataResponse {
  283. string directory = 1;
  284. EventNotification event_notification = 2;
  285. int64 ts_ns = 3;
  286. }
  287. message LogEntry {
  288. int64 ts_ns = 1;
  289. int32 partition_key_hash = 2;
  290. bytes data = 3;
  291. }
  292. message KeepConnectedRequest {
  293. string name = 1;
  294. uint32 grpc_port = 2;
  295. repeated string resources = 3;
  296. }
  297. message KeepConnectedResponse {
  298. }
  299. message LocateBrokerRequest {
  300. string resource = 1;
  301. }
  302. message LocateBrokerResponse {
  303. bool found = 1;
  304. // if found, send the exact address
  305. // if not found, send the full list of existing brokers
  306. message Resource {
  307. string grpc_addresses = 1;
  308. int32 resource_count = 2;
  309. }
  310. repeated Resource resources = 2;
  311. }
  312. /////////////////////////
  313. // Key-Value operations
  314. /////////////////////////
  315. message KvGetRequest {
  316. bytes key = 1;
  317. }
  318. message KvGetResponse {
  319. bytes value = 1;
  320. string error = 2;
  321. }
  322. message KvPutRequest {
  323. bytes key = 1;
  324. bytes value = 2;
  325. }
  326. message KvPutResponse {
  327. string error = 1;
  328. }
  329. /////////////////////////
  330. // path-based configurations
  331. /////////////////////////
  332. message FilerConf {
  333. int32 version = 1;
  334. message PathConf {
  335. string location_prefix = 1;
  336. string collection = 2;
  337. string replication = 3;
  338. string ttl = 4;
  339. string disk_type = 5;
  340. bool fsync = 6;
  341. uint32 volume_growth_count = 7;
  342. bool read_only = 8;
  343. string data_center = 9;
  344. string rack = 10;
  345. string data_node = 11;
  346. }
  347. repeated PathConf locations = 2;
  348. }
  349. /////////////////////////
  350. // Remote Storage related
  351. /////////////////////////
  352. message CacheRemoteObjectToLocalClusterRequest {
  353. string directory = 1;
  354. string name = 2;
  355. }
  356. message CacheRemoteObjectToLocalClusterResponse {
  357. Entry entry = 1;
  358. }