KeySpaceManagerProtocol.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. /**
  19. * These .proto interfaces are private and unstable.
  20. * Please see http://wiki.apache.org/hadoop/Compatibility
  21. * for what changes are allowed for a *unstable* .proto interface.
  22. */
  23. option java_package = "org.apache.hadoop.ozone.protocol.proto";
  24. option java_outer_classname = "KeySpaceManagerProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.hdfs.ozone;
  28. /**
  29. This is file contains the protocol to communicate with
  30. Ozone key space manager. Ozone KSM manages the namespace for ozone.
  31. This is similar to Namenode for Ozone.
  32. */
  33. import "hdfs.proto";
  34. import "Ozone.proto";
  35. enum Status {
  36. OK = 1;
  37. VOLUME_NOT_UNIQUE = 2;
  38. VOLUME_NOT_FOUND = 3;
  39. VOLUME_NOT_EMPTY = 4;
  40. VOLUME_ALREADY_EXISTS = 5;
  41. USER_NOT_FOUND = 6;
  42. USER_TOO_MANY_VOLUMES = 7;
  43. BUCKET_NOT_FOUND = 8;
  44. BUCKET_NOT_EMPTY = 9;
  45. BUCKET_ALREADY_EXISTS = 10;
  46. KEY_ALREADY_EXISTS = 11;
  47. KEY_NOT_FOUND = 12;
  48. ACCESS_DENIED = 13;
  49. INTERNAL_ERROR = 14;
  50. }
  51. message VolumeInfo {
  52. required string adminName = 1;
  53. required string ownerName = 2;
  54. required string volume = 3;
  55. optional uint64 quotaInBytes = 4;
  56. repeated KeyValue metadata = 5;
  57. repeated OzoneAclInfo volumeAcls = 6;
  58. }
  59. /**
  60. Creates a volume
  61. */
  62. message CreateVolumeRequest {
  63. required VolumeInfo volumeInfo = 1;
  64. }
  65. message CreateVolumeResponse {
  66. required Status status = 1;
  67. }
  68. message VolumeList {
  69. repeated string volumeNames = 1;
  70. }
  71. /**
  72. Changes the Volume Properties -- like ownership and quota for a volume.
  73. */
  74. message SetVolumePropertyRequest {
  75. required string volumeName = 1;
  76. optional string ownerName = 2;
  77. optional uint64 quotaInBytes = 3;
  78. }
  79. message SetVolumePropertyResponse {
  80. required Status status = 1;
  81. }
  82. /**
  83. * Checks if the user has specified permissions for the volume
  84. */
  85. message CheckVolumeAccessRequest {
  86. required string volumeName = 1;
  87. required OzoneAclInfo userAcl = 2;
  88. }
  89. message CheckVolumeAccessResponse {
  90. required Status status = 1;
  91. }
  92. /**
  93. Returns information about a volume.
  94. */
  95. message InfoVolumeRequest {
  96. required string volumeName = 1;
  97. }
  98. message InfoVolumeResponse {
  99. required Status status = 1;
  100. optional VolumeInfo volumeInfo = 2;
  101. }
  102. /**
  103. Deletes an existing volume.
  104. */
  105. message DeleteVolumeRequest {
  106. required string volumeName = 1;
  107. }
  108. message DeleteVolumeResponse {
  109. required Status status = 1;
  110. }
  111. /**
  112. List Volumes -- List all volumes in the cluster or by user.
  113. */
  114. message ListVolumeRequest {
  115. enum Scope {
  116. USER_VOLUMES = 1; // User volumes -- called by user
  117. VOLUMES_BY_USER = 2; // User volumes - called by Admin
  118. VOLUMES_BY_CLUSTER = 3; // All volumes in the cluster
  119. }
  120. required Scope scope = 1;
  121. required string volumeName = 2;
  122. optional string userName = 3;
  123. optional string prefix = 4;
  124. optional string prevKey = 5;
  125. optional uint64 maxKeys = 6;
  126. }
  127. message ListVolumeResponse {
  128. enum Status {
  129. OK = 1;
  130. ACCESS_DENIED = 2;
  131. REQUIRED_ARG_MISSING = 3;
  132. }
  133. required Status status = 1;
  134. repeated VolumeInfo volumeInfo = 2;
  135. }
  136. message BucketInfo {
  137. required string volumeName = 1;
  138. required string bucketName = 2;
  139. repeated OzoneAclInfo acls = 3;
  140. required bool isVersionEnabled = 4 [default = false];
  141. required StorageTypeProto storageType = 5 [default = DISK];
  142. }
  143. message BucketArgs {
  144. required string volumeName = 1;
  145. required string bucketName = 2;
  146. repeated OzoneAclInfo addAcls = 3;
  147. repeated OzoneAclInfo removeAcls = 4;
  148. optional bool isVersionEnabled = 5;
  149. optional StorageTypeProto storageType = 6;
  150. }
  151. message OzoneAclInfo {
  152. enum OzoneAclType {
  153. USER = 1;
  154. GROUP = 2;
  155. WORLD = 3;
  156. }
  157. enum OzoneAclRights {
  158. READ = 1;
  159. WRITE = 2;
  160. READ_WRITE = 3;
  161. }
  162. required OzoneAclType type = 1;
  163. required string name = 2;
  164. required OzoneAclRights rights = 3;
  165. }
  166. message CreateBucketRequest {
  167. required BucketInfo bucketInfo = 1;
  168. }
  169. message CreateBucketResponse {
  170. required Status status = 1;
  171. }
  172. message InfoBucketRequest {
  173. required string volumeName = 1;
  174. required string bucketName = 2;
  175. }
  176. message InfoBucketResponse {
  177. required Status status = 1;
  178. optional BucketInfo bucketInfo = 2;
  179. }
  180. message KeyArgs {
  181. required string volumeName = 1;
  182. required string bucketName = 2;
  183. required string keyName = 3;
  184. optional uint64 dataSize = 4;
  185. }
  186. message KeyInfo {
  187. required string volumeName = 1;
  188. required string bucketName = 2;
  189. required string keyName = 3;
  190. required uint64 dataSize = 4;
  191. required string blockKey = 5;
  192. required string containerName = 6;
  193. required bool shouldCreateContainer = 7;
  194. }
  195. message LocateKeyRequest {
  196. required KeyArgs keyArgs = 1;
  197. }
  198. message LocateKeyResponse {
  199. required Status status = 1;
  200. optional KeyInfo keyInfo = 2;
  201. }
  202. message SetBucketPropertyRequest {
  203. required BucketArgs bucketArgs = 1;
  204. }
  205. message SetBucketPropertyResponse {
  206. required Status status = 1;
  207. }
  208. message DeleteBucketRequest {
  209. required string volumeName = 1;
  210. required string bucketName = 2;
  211. }
  212. message DeleteBucketResponse {
  213. required Status status = 1;
  214. }
  215. /**
  216. The KSM service that takes care of Ozone namespace.
  217. */
  218. service KeySpaceManagerService {
  219. /**
  220. Creates a Volume.
  221. */
  222. rpc createVolume(CreateVolumeRequest)
  223. returns(CreateVolumeResponse);
  224. /**
  225. Allows modificiation of volume properties.
  226. */
  227. rpc setVolumeProperty(SetVolumePropertyRequest)
  228. returns (SetVolumePropertyResponse);
  229. /**
  230. Checks if the specified volume is accesible by the specified user.
  231. */
  232. rpc checkVolumeAccess(CheckVolumeAccessRequest)
  233. returns (CheckVolumeAccessResponse);
  234. /**
  235. Gets Volume information.
  236. */
  237. rpc infoVolume(InfoVolumeRequest)
  238. returns(InfoVolumeResponse);
  239. /**
  240. Deletes a volume if it is empty.
  241. */
  242. rpc deleteVolume(DeleteVolumeRequest)
  243. returns (DeleteVolumeResponse);
  244. /**
  245. Lists Volumes
  246. */
  247. rpc listVolumes(ListVolumeRequest)
  248. returns (ListVolumeResponse);
  249. /**
  250. Creates a Bucket.
  251. */
  252. rpc createBucket(CreateBucketRequest)
  253. returns(CreateBucketResponse);
  254. /**
  255. Get Bucket information.
  256. */
  257. rpc infoBucket(InfoBucketRequest)
  258. returns(InfoBucketResponse);
  259. /**
  260. Sets bucket properties.
  261. */
  262. rpc setBucketProperty(SetBucketPropertyRequest)
  263. returns(SetBucketPropertyResponse);
  264. /**
  265. Get key.
  266. */
  267. rpc createKey(LocateKeyRequest)
  268. returns(LocateKeyResponse);
  269. /**
  270. Look up for an existing key.
  271. */
  272. rpc lookupKey(LocateKeyRequest)
  273. returns(LocateKeyResponse);
  274. /**
  275. Delete an existing key.
  276. */
  277. rpc deleteKey(LocateKeyRequest)
  278. returns(LocateKeyResponse);
  279. /**
  280. Deletes a bucket from volume if it is empty.
  281. */
  282. rpc deleteBucket(DeleteBucketRequest)
  283. returns (DeleteBucketResponse);
  284. }