KeySpaceManagerProtocol.proto 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. required uint64 creationTime = 7;
  59. }
  60. /**
  61. Creates a volume
  62. */
  63. message CreateVolumeRequest {
  64. required VolumeInfo volumeInfo = 1;
  65. }
  66. message CreateVolumeResponse {
  67. required Status status = 1;
  68. }
  69. message VolumeList {
  70. repeated string volumeNames = 1;
  71. }
  72. /**
  73. Changes the Volume Properties -- like ownership and quota for a volume.
  74. */
  75. message SetVolumePropertyRequest {
  76. required string volumeName = 1;
  77. optional string ownerName = 2;
  78. optional uint64 quotaInBytes = 3;
  79. }
  80. message SetVolumePropertyResponse {
  81. required Status status = 1;
  82. }
  83. /**
  84. * Checks if the user has specified permissions for the volume
  85. */
  86. message CheckVolumeAccessRequest {
  87. required string volumeName = 1;
  88. required OzoneAclInfo userAcl = 2;
  89. }
  90. message CheckVolumeAccessResponse {
  91. required Status status = 1;
  92. }
  93. /**
  94. Returns information about a volume.
  95. */
  96. message InfoVolumeRequest {
  97. required string volumeName = 1;
  98. }
  99. message InfoVolumeResponse {
  100. required Status status = 1;
  101. optional VolumeInfo volumeInfo = 2;
  102. }
  103. /**
  104. Deletes an existing volume.
  105. */
  106. message DeleteVolumeRequest {
  107. required string volumeName = 1;
  108. }
  109. message DeleteVolumeResponse {
  110. required Status status = 1;
  111. }
  112. /**
  113. List Volumes -- List all volumes in the cluster or by user.
  114. */
  115. message ListVolumeRequest {
  116. enum Scope {
  117. USER_VOLUMES = 1; // User volumes -- called by user
  118. VOLUMES_BY_USER = 2; // User volumes - called by Admin
  119. VOLUMES_BY_CLUSTER = 3; // All volumes in the cluster
  120. }
  121. required Scope scope = 1;
  122. optional string userName = 2;
  123. optional string prefix = 3;
  124. optional string prevKey = 4;
  125. optional uint32 maxKeys = 5;
  126. }
  127. message ListVolumeResponse {
  128. required Status status = 1;
  129. repeated VolumeInfo volumeInfo = 2;
  130. }
  131. message BucketInfo {
  132. required string volumeName = 1;
  133. required string bucketName = 2;
  134. repeated OzoneAclInfo acls = 3;
  135. required bool isVersionEnabled = 4 [default = false];
  136. required StorageTypeProto storageType = 5 [default = DISK];
  137. required uint64 creationTime = 6;
  138. }
  139. message BucketArgs {
  140. required string volumeName = 1;
  141. required string bucketName = 2;
  142. repeated OzoneAclInfo addAcls = 3;
  143. repeated OzoneAclInfo removeAcls = 4;
  144. optional bool isVersionEnabled = 5;
  145. optional StorageTypeProto storageType = 6;
  146. }
  147. message OzoneAclInfo {
  148. enum OzoneAclType {
  149. USER = 1;
  150. GROUP = 2;
  151. WORLD = 3;
  152. }
  153. enum OzoneAclRights {
  154. READ = 1;
  155. WRITE = 2;
  156. READ_WRITE = 3;
  157. }
  158. required OzoneAclType type = 1;
  159. required string name = 2;
  160. required OzoneAclRights rights = 3;
  161. }
  162. message CreateBucketRequest {
  163. required BucketInfo bucketInfo = 1;
  164. }
  165. message CreateBucketResponse {
  166. required Status status = 1;
  167. }
  168. message InfoBucketRequest {
  169. required string volumeName = 1;
  170. required string bucketName = 2;
  171. }
  172. message InfoBucketResponse {
  173. required Status status = 1;
  174. optional BucketInfo bucketInfo = 2;
  175. }
  176. message ListBucketsRequest {
  177. required string volumeName = 1;
  178. optional string startKey = 2;
  179. optional string prefix = 3;
  180. optional int32 count = 4;
  181. }
  182. message ListBucketsResponse {
  183. required Status status = 1;
  184. repeated BucketInfo bucketInfo = 2;
  185. }
  186. message KeyArgs {
  187. required string volumeName = 1;
  188. required string bucketName = 2;
  189. required string keyName = 3;
  190. optional uint64 dataSize = 4;
  191. optional hadoop.hdfs.ozone.ReplicationType type = 5;
  192. optional hadoop.hdfs.ozone.ReplicationFactor factor = 6;
  193. }
  194. message KeyLocation {
  195. required string blockID = 1;
  196. required string containerName = 2;
  197. required bool shouldCreateContainer = 3;
  198. required uint64 offset = 4;
  199. required uint64 length = 5;
  200. required uint32 index = 6;
  201. }
  202. message KeyInfo {
  203. required string volumeName = 1;
  204. required string bucketName = 2;
  205. required string keyName = 3;
  206. required uint64 dataSize = 4;
  207. repeated KeyLocation keyLocationList = 5;
  208. required uint64 creationTime = 6;
  209. required uint64 modificationTime = 7;
  210. }
  211. message LocateKeyRequest {
  212. required KeyArgs keyArgs = 1;
  213. }
  214. message LocateKeyResponse {
  215. required Status status = 1;
  216. optional KeyInfo keyInfo = 2;
  217. }
  218. message SetBucketPropertyRequest {
  219. required BucketArgs bucketArgs = 1;
  220. }
  221. message SetBucketPropertyResponse {
  222. required Status status = 1;
  223. }
  224. message DeleteBucketRequest {
  225. required string volumeName = 1;
  226. required string bucketName = 2;
  227. }
  228. message DeleteBucketResponse {
  229. required Status status = 1;
  230. }
  231. message ListKeysRequest {
  232. required string volumeName = 1;
  233. required string bucketName = 2;
  234. optional string startKey = 3;
  235. optional string prefix = 4;
  236. optional int32 count = 5;
  237. }
  238. message ListKeysResponse {
  239. required Status status = 1;
  240. repeated KeyInfo keyInfo = 2;
  241. }
  242. /**
  243. The KSM service that takes care of Ozone namespace.
  244. */
  245. service KeySpaceManagerService {
  246. /**
  247. Creates a Volume.
  248. */
  249. rpc createVolume(CreateVolumeRequest)
  250. returns(CreateVolumeResponse);
  251. /**
  252. Allows modificiation of volume properties.
  253. */
  254. rpc setVolumeProperty(SetVolumePropertyRequest)
  255. returns (SetVolumePropertyResponse);
  256. /**
  257. Checks if the specified volume is accesible by the specified user.
  258. */
  259. rpc checkVolumeAccess(CheckVolumeAccessRequest)
  260. returns (CheckVolumeAccessResponse);
  261. /**
  262. Gets Volume information.
  263. */
  264. rpc infoVolume(InfoVolumeRequest)
  265. returns(InfoVolumeResponse);
  266. /**
  267. Deletes a volume if it is empty.
  268. */
  269. rpc deleteVolume(DeleteVolumeRequest)
  270. returns (DeleteVolumeResponse);
  271. /**
  272. Lists Volumes
  273. */
  274. rpc listVolumes(ListVolumeRequest)
  275. returns (ListVolumeResponse);
  276. /**
  277. Creates a Bucket.
  278. */
  279. rpc createBucket(CreateBucketRequest)
  280. returns(CreateBucketResponse);
  281. /**
  282. Get Bucket information.
  283. */
  284. rpc infoBucket(InfoBucketRequest)
  285. returns(InfoBucketResponse);
  286. /**
  287. Sets bucket properties.
  288. */
  289. rpc setBucketProperty(SetBucketPropertyRequest)
  290. returns(SetBucketPropertyResponse);
  291. /**
  292. Get key.
  293. */
  294. rpc createKey(LocateKeyRequest)
  295. returns(LocateKeyResponse);
  296. /**
  297. Look up for an existing key.
  298. */
  299. rpc lookupKey(LocateKeyRequest)
  300. returns(LocateKeyResponse);
  301. /**
  302. Delete an existing key.
  303. */
  304. rpc deleteKey(LocateKeyRequest)
  305. returns(LocateKeyResponse);
  306. /**
  307. Deletes a bucket from volume if it is empty.
  308. */
  309. rpc deleteBucket(DeleteBucketRequest)
  310. returns (DeleteBucketResponse);
  311. /**
  312. List Buckets.
  313. */
  314. rpc listBuckets(ListBucketsRequest)
  315. returns(ListBucketsResponse);
  316. /**
  317. List Keys.
  318. */
  319. rpc listKeys(ListKeysRequest)
  320. returns(ListKeysResponse);
  321. }