From 2b8b3754f6c28594307ea377b1ffe68f6b09b6d0 Mon Sep 17 00:00:00 2001 From: Anu Engineer Date: Mon, 14 Nov 2016 12:27:38 -0800 Subject: [PATCH] HDFS-11130. Block Storage : Add storage client to server protocol. Contributed by Chen Lian --- .../proto/CBlockClientServerProtocol.proto | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/main/proto/CBlockClientServerProtocol.proto diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/CBlockClientServerProtocol.proto b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/CBlockClientServerProtocol.proto new file mode 100644 index 00000000000..d19dd4b58c7 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/CBlockClientServerProtocol.proto @@ -0,0 +1,76 @@ +/** + * 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 = "CBlockClientServerProtocolProtos"; +option java_generic_services = true; +option java_generate_equals_and_hash = true; +package hadoop.cblock; + +/** +* This message is sent from CBlock client side to CBlock server to +* mount a volume specified by owner name and volume name. +* +* Right now, this is the only communication between client and server. +* After the volume is mounted, CBlock client will talk to containers +* by itself, nothing to do with CBlock server. +*/ +message MountVolumeRequestProto { + required string userName = 1; + required string volumeName = 2; +} + +/** +* This message is sent from CBlock server to CBlock client as response +* of mount a volume. It checks the whether the volume is valid to access +* at all.(e.g. volume exist) +* +* And include enough information (volume size, block size, list of +* containers for this volume) for client side to perform read/write on +* the volume. +*/ +message MountVolumeResponseProto { + required bool isValid = 1; + optional string userName = 2; + optional string volumeName = 3; + optional uint64 volumeSize = 4; + optional uint32 blockSize = 5; + repeated ContainerIDProto allContainerIDs = 6; +} + +/** +* This message include ID of container which can be used to locate the +* container. Since the order of containers needs to be maintained, also +* includes a index field to verify the correctness of the order. +*/ +message ContainerIDProto { + required string containerID = 1; + required uint64 index = 2; +} + +service CBlockClientServerProtocolService { + /** + * mount the volume. + */ + rpc mountVolume(MountVolumeRequestProto) returns (MountVolumeResponseProto); +}