HDFS-11127. Block Storage : add block storage service protocol. Contributed by Chen Liang
This commit is contained in:
parent
8274ff356a
commit
3d83ee25c5
|
@ -0,0 +1,133 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These .proto interfaces are private and unstable.
|
||||||
|
* Please see http://wiki.apache.org/hadoop/Compatibility
|
||||||
|
* for what changes are allowed for a *unstable* .proto interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
option java_package = "org.apache.hadoop.cblock.protocol.proto";
|
||||||
|
option java_outer_classname = "CBlockServiceProtocolProtos";
|
||||||
|
option java_generic_services = true;
|
||||||
|
option java_generate_equals_and_hash = true;
|
||||||
|
package hadoop.cblock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent to CBlock server to create a volume. Creating
|
||||||
|
* volume requries four parameters: owner of the volume, name of the volume
|
||||||
|
* size of volume and block size of the volume.
|
||||||
|
*/
|
||||||
|
message CreateVolumeRequestProto {
|
||||||
|
required string userName = 1;
|
||||||
|
required string volumeName = 2;
|
||||||
|
required uint64 volumeSize = 3;
|
||||||
|
optional uint32 blockSize = 4 [default = 4096];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty response message.
|
||||||
|
*/
|
||||||
|
message CreateVolumeResponseProto {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent to CBlock server to delete a volume. The volume
|
||||||
|
* is specified by owner name and volume name. If force is set to
|
||||||
|
* false, volume will be deleted only if it is empty. Otherwise delete it
|
||||||
|
* regardless.
|
||||||
|
*/
|
||||||
|
message DeleteVolumeRequestProto {
|
||||||
|
required string userName = 1;
|
||||||
|
required string volumeName = 2;
|
||||||
|
optional bool force = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty response message.
|
||||||
|
*/
|
||||||
|
message DeleteVolumeResponseProto {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent to CBlock server to request info of a volume. The
|
||||||
|
* volume is specified by owner name and volume name.
|
||||||
|
*/
|
||||||
|
message InfoVolumeRequestProto {
|
||||||
|
required string userName = 1;
|
||||||
|
required string volumeName = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message describes the information of a volume.
|
||||||
|
* Currently, the info includes the volume creation parameters and a number
|
||||||
|
* as the usage of the volume, in terms of number of bytes.
|
||||||
|
*/
|
||||||
|
message VolumeInfoProto {
|
||||||
|
required string userName = 1;
|
||||||
|
required string volumeName = 2;
|
||||||
|
required uint64 volumeSize = 3;
|
||||||
|
required uint64 blockSize = 4;
|
||||||
|
optional uint64 usage = 5;
|
||||||
|
// TODO : potentially volume ACL
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent from CBlock server as response of info volume request.
|
||||||
|
*/
|
||||||
|
message InfoVolumeResponseProto {
|
||||||
|
optional VolumeInfoProto volumeInfo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent to CBlock server to list all available volume.
|
||||||
|
*/
|
||||||
|
message ListVolumeRequestProto {
|
||||||
|
optional string userName = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This message is sent from CBlock server as response of volume listing.
|
||||||
|
*/
|
||||||
|
message ListVolumeResponseProto {
|
||||||
|
repeated VolumeInfoProto volumeEntry = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
service CBlockServiceProtocolService {
|
||||||
|
/**
|
||||||
|
* Create a volume.
|
||||||
|
*/
|
||||||
|
rpc createVolume(CreateVolumeRequestProto) returns(CreateVolumeResponseProto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a volume.
|
||||||
|
*/
|
||||||
|
rpc deleteVolume(DeleteVolumeRequestProto) returns(DeleteVolumeResponseProto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get info of a volume.
|
||||||
|
*/
|
||||||
|
rpc infoVolume(InfoVolumeRequestProto) returns(InfoVolumeResponseProto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List all available volumes.
|
||||||
|
*/
|
||||||
|
rpc listVolume(ListVolumeRequestProto) returns(ListVolumeResponseProto);
|
||||||
|
}
|
Loading…
Reference in New Issue