HDFS-2597 ClientNameNodeProtocol in Protocol Buffers (sanjay)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1211769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanjay Radia 2011-12-08 06:48:45 +00:00
parent d9690b0922
commit 9f69ae5a9e
3 changed files with 47050 additions and 3 deletions

View File

@ -79,13 +79,15 @@ Trunk (unreleased changes)
HDFS-2410. Further cleanup of hardcoded configuration keys and values.
(suresh)
HADOOP-7862 Hdfs changes to work with HADOOP 7862:
Move the support for multiple protocols to lower layer so that Writable,
PB and Avro can all use it (Sanjay)
HADOOP-7862 Hdfs changes to work with HADOOP 7862:
Move the support for multiple protocols to lower layer so that Writable,
PB and Avro can all use it (Sanjay)
HDFS-1580. Add interface for generic Write Ahead Logging mechanisms.
(Ivan Kelly via jitendra)
HDFS-2597 ClientNameNodeProtocol in Protocol Buffers (sanjay)
OPTIMIZATIONS
HDFS-2477. Optimize computing the diff between a block report and the
namenode state. (Tomasz Nykiel via hairong)

View File

@ -0,0 +1,516 @@
/**
* 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.
*/
option java_package = "org.apache.hadoop.hdfs.protocol.proto";
option java_outer_classname = "ClientNamenodeProtocolProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
import "hdfs.proto";
/**
* The ClientNamenodeProtocol Service defines the interface between a client
* (as runnign inside a MR Task) and the Namenode.
* See org.apache.hadoop.hdfs.protocol.ClientProtocol for the javadoc
* for each of the methods.
* The exceptions declared in the above class also apply to this protocol.
* Exceptions are unwrapped and thrown by the PB libraries.
*/
message GetBlockLocationsRequestProto {
required string src = 1; // file name
required uint64 offset = 2; // range start offset
required uint64 length = 3; // range length
}
message GetBlockLocationsResponseProto {
required LocatedBlocksProto locations = 1;
}
message GetServerDefaultsRequestProto { // No parameters
}
message GetServerDefaultsResponseProto {
required FsServerDefaultsProto serverDefaults = 1;
}
enum CreateFlag {
CREATE = 0x01; // Create a file
OVERWRITE = 0x02; // Truncate/overwrite a file. Same as POSIX O_TRUNC
APPEND = 0x04; // Append to a file
}
message CreateRequestProto {
required string src = 1;
required FsPermissionProto masked = 2;
required string clientName = 3;
required uint32 createFlag = 4; // bits set using CreateFlag
required bool createParent = 5;
required uint32 replication = 6; // Short: Only 16 bits used
required uint64 blockSize = 7;
}
message CreateResponseProto { // void response
}
message AppendRequestProto {
required string src = 1;
required string clientName = 2;
}
message AppendResponseProto {
required LocatedBlockProto block = 1;
}
message SetReplicationRequestProto {
required string src = 1;
required uint32 replication = 2; // Short: Only 16 bits used
}
message SetReplicationResponseProto {
required bool result = 1;
}
message SetPermissionRequestProto {
required string src = 1;
required FsPermissionProto permission = 2;
}
message SetPermissionResponseProto { // void response
}
message SetOwnerRequestProto {
required string src = 1;
required string username = 2;
required string groupname = 3;
}
message SetOwnerResponseProto { // void response
}
message AbandonBlockRequestProto {
required ExtendedBlockProto b = 1;
required string src = 2;
required string holder = 3;
}
message AbandonBlockResponseProto { // void response
}
message AddBlockRequestProto {
required string src = 1;
required string clientName = 2;
required ExtendedBlockProto previous = 3;
repeated DatanodeInfoProto excludeNodes = 4;
}
message AddBlockResponseProto {
required LocatedBlockProto block = 1;
}
message GetAdditionalDatanodeRequestProto {
required string src = 1;
required ExtendedBlockProto blk = 2;
repeated DatanodeInfoProto existings = 3;
repeated DatanodeInfoProto excludes = 4;
required uint32 numAdditionalNodes = 5;
required string clientName = 6;
}
message GetAdditionalDatanodeResponseProto {
required LocatedBlockProto block = 1;
}
message CompleteRequestProto {
required string src = 1;
required string clientName = 2;
required ExtendedBlockProto last = 3;
}
message CompleteResponseProto {
required bool result = 1;
}
message ReportBadBlocksRequestProto {
repeated LocatedBlockProto blocks = 1;
}
message ReportBadBlocksResponseProto { // void response
}
message ConcatRequestProto {
required string trg = 1;
repeated string srcs = 2;
}
message ConcatResponseProto { // void response
}
message RenameRequestProto {
required string src = 1;
required string dst = 2;
}
message RenameResponseProto { // void response
required bool result = 1;
}
message Rename2RequestProto {
required string src = 1;
required string dst = 2;
required bool overwriteDest = 3;
}
message Rename2ResponseProto { // void response
}
message DeleteRequestProto {
required string src = 1;
required bool recursive = 2;
}
message DeleteResponseProto {
required bool result = 1;
}
message MkdirsRequestProto {
required string src = 1;
required FsPermissionProto masked = 2;
required bool createParent = 3;
}
message MkdirsResponseProto {
required bool result = 1;
}
message GetListingRequestProto {
required string src = 1;
required bytes startAfter = 2;
required bool needLocation = 3;
}
message GetListingResponseProto {
required DirectoryListingProto dirList = 1;
}
message RenewLeaseRequestProto {
required string clientName = 1;
}
message RenewLeaseResponseProto { //void response
}
message RecoverLeaseRequestProto {
required string src = 1;
required string clientName = 2;
}
message RecoverLeaseResponseProto {
required bool result = 1;
}
message GetFsStatusRequestProto { // no input paramters
}
message GetFsStatsResponseProto {
required uint64 capacity = 1;
required uint64 used = 2;
required uint64 remaining = 3;
required uint64 under_replicated = 4;
required uint64 corrupt_blocks = 5;
required uint64 missing_blocks = 6;
}
enum DatanodeReportType { // type of the datanode report
ALL = 1;
LIVE = 3;
DEAD = 3;
}
message GetDatanodeReportRequestProto {
required DatanodeReportType type = 1;
}
message GetDatanodeReportResponseProto {
repeated DatanodeInfoProto di = 1;
}
message GetPreferredBlockSizeRequestProto {
required string filename = 1;
}
message GetPreferredBlockSizeResponseProto {
required uint64 bsize = 1;
}
enum SafeModeAction {
SAFEMODE_LEAVE = 1;
SAFEMODE_ENTER = 2;
SAFEMODE_GET = 3;
}
message SetSafeModeRequestProto {
required SafeModeAction action = 1;
}
message SetSafeModeResponseProto {
required bool result = 1;
}
message SaveNamespaceRequestProto { // no parameters
}
message SaveNamespaceResponseProto { // void response
}
message RestoreFailedStorageRequestProto {
required string arg = 1;
}
message RestoreFailedStorageResponseProto {
required bool result = 1;
}
message RefreshNodesRequestProto { // no parameters
}
message RefreshNodesResponseProto { // void response
}
message FinalizeUpgradeRequestProto { // no parameters
}
message FinalizeUpgradeResponseProto { // void response
}
enum UpgradeAction {
GET_STATUS = 1;
DETAILED_STATUS = 2;
FORCE_PROCEED = 3;
}
message DistributedUpgradeProgressRequestProto {
required UpgradeAction action = 1;
}
message DistributedUpgradeProgressResponseProto {
required UpgradeStatusReportProto report = 1;
}
message ListCorruptFileBlocksRequestProto {
required string path = 1;
required string cookie = 2;
}
message ListCorruptFileBlocksResponseProto {
required CorruptFileBlocksProto corrupt = 1;
}
message MetaSaveRequestProto {
required string filename = 1;
}
message MetaSaveResponseProto { // void response
}
message GetFileInfoRequestProto {
required string src = 1;
}
message GetFileInfoResponseProto {
required HdfsFileStatusProto fs = 1;
}
message GetFileLinkInfoRequestProto {
required string src = 1;
}
message GetFileLinkInfoResponseProto {
required HdfsFileStatusProto fs = 1;
}
message GetContentSummaryRequestProto {
required string path = 1;
}
message GetContentSummaryResponseProto {
required ContentSummaryProto summary = 1;
}
message SetQuotaRequestProto {
required string path = 1;
required uint64 namespaceQuota = 2;
required uint64 diskspaceQuota = 3;
}
message SetQuotaResponseProto { // void response
}
message FsyncRequestProto {
required string src = 1;
required string client = 2;
}
message FsyncResponseProto { // void response
}
message SetTimesRequestProto {
required string src = 1;
required uint64 mtime = 2;
required uint64 atime = 3;
}
message SetTimesResponseProto { // void response
}
message CreateSymlinkRequestProto {
required string target = 1;
required string link = 2;
required FsPermissionProto dirPerm = 3;
required bool createParent = 4;
}
message CreateSymlinkResponseProto { // void response
}
message GetLinkTargetRequestProto {
required string path = 1;
}
message GetLinkTargetResponseProto {
required string targetPath = 1;
}
message UpdateBlockForPipelineRequestProto {
required ExtendedBlockProto block = 1;
required string clientName = 2;
}
message UpdateBlockForPipelineResponseProto {
required LocatedBlockProto block = 1;
}
message UpdatePipelineRequestProto {
required string clientName = 1;
required ExtendedBlockProto oldBlock = 2;
required ExtendedBlockProto newBlock = 3;
repeated DatanodeIDProto newNodes = 4;
}
message UpdatePipelineResponseProto { // void response
}
message GetDelegationTokenRequestProto {
required string renewer = 1;
}
message GetDelegationTokenResponseProto {
required BlockTokenIdentifierProto token = 1;
}
message RenewDelegationTokenRequestProto {
required BlockTokenIdentifierProto token = 1;
}
message RenewDelegationTokenResponseProto {
required uint64 newExireTime = 1;
}
message CancelDelegationTokenRequestProto {
required BlockTokenIdentifierProto token = 1;
}
message CancelDelegationTokenResponseProto { // void response
}
message SetBalancerBandwidthRequestProto {
required int64 bandwidth = 1;
}
message SetBalancerBandwidthResponseProto { // void response
}
service ClientNamenodeProtocol {
rpc getBlockLocations(GetBlockLocationsRequestProto)
returns(GetBlockLocationsResponseProto);
rpc getServerDefaults(GetServerDefaultsRequestProto)
returns(GetServerDefaultsResponseProto);
rpc create(CreateRequestProto)returns(CreateResponseProto);
rpc append(AppendRequestProto) returns(AppendResponseProto);
rpc setReplication(SetReplicationRequestProto)
returns(SetReplicationResponseProto);
rpc setPermission(SetPermissionRequestProto)
returns(SetPermissionResponseProto);
rpc setOwner(SetOwnerRequestProto) returns(SetOwnerResponseProto);
rpc abandonBlock(AbandonBlockRequestProto) returns(AbandonBlockResponseProto);
rpc addBlock(AddBlockRequestProto) returns(AddBlockResponseProto);
rpc getAdditionalDatanode(GetAdditionalDatanodeRequestProto)
returns(GetAdditionalDatanodeResponseProto);
rpc complete(CompleteRequestProto) returns(CompleteResponseProto);
rpc reportBadBlocks(ReportBadBlocksRequestProto)
returns(ReportBadBlocksResponseProto);
rpc concat(ConcatRequestProto) returns(ConcatResponseProto);
rpc rename(RenameRequestProto) returns(RenameResponseProto);
rpc rename2(Rename2RequestProto) returns(Rename2ResponseProto);
rpc delete(DeleteRequestProto) returns(DeleteResponseProto);
rpc mkdirs(MkdirsRequestProto) returns(MkdirsResponseProto);
rpc getListing(GetListingRequestProto) returns(GetListingResponseProto);
rpc renewLease(RenewLeaseRequestProto) returns(RenewLeaseResponseProto);
rpc recoverLease(RecoverLeaseRequestProto)
returns(RecoverLeaseResponseProto);
rpc getFsStats(GetFsStatusRequestProto) returns(GetFsStatsResponseProto);
rpc getDatanodeReport(GetDatanodeReportRequestProto)
returns(GetDatanodeReportResponseProto);
rpc getPreferredBlockSize(GetPreferredBlockSizeRequestProto)
returns(GetPreferredBlockSizeResponseProto);
rpc setSafeMode(SetSafeModeRequestProto)
returns(SetSafeModeResponseProto);
rpc saveNamespace(SaveNamespaceRequestProto)
returns(SaveNamespaceResponseProto);
rpc restoreFailedStorage(RestoreFailedStorageRequestProto)
returns(RestoreFailedStorageResponseProto);
rpc refreshNodes(RefreshNodesRequestProto) returns(RefreshNodesResponseProto);
rpc finalizeUpgrade(FinalizeUpgradeRequestProto)
returns(FinalizeUpgradeResponseProto);
rpc distributedUpgradeProgress(DistributedUpgradeProgressRequestProto)
returns(DistributedUpgradeProgressResponseProto);
rpc listCorruptFileBlocks(ListCorruptFileBlocksRequestProto)
returns(ListCorruptFileBlocksResponseProto);
rpc metaSave(MetaSaveRequestProto) returns(MetaSaveResponseProto);
rpc getFileInfo(GetFileInfoRequestProto) returns(GetFileInfoResponseProto);
rpc getFileLinkInfo(GetFileLinkInfoRequestProto)
returns(GetFileLinkInfoResponseProto);
rpc getContentSummary(GetContentSummaryRequestProto)
returns(GetContentSummaryResponseProto);
rpc setQuota(SetQuotaRequestProto) returns(SetQuotaResponseProto);
rpc fsync(FsyncRequestProto) returns(FsyncResponseProto);
rpc setTimes(SetTimesRequestProto) returns(SetTimesResponseProto);
rpc createSymlink(CreateSymlinkRequestProto)
returns(CreateSymlinkResponseProto);
rpc getLinkTarget(GetLinkTargetRequestProto)
returns(GetLinkTargetResponseProto);
rpc updateBlockForPipeline(UpdateBlockForPipelineRequestProto)
returns(UpdateBlockForPipelineResponseProto);
rpc updatePipeline(UpdatePipelineRequestProto)
returns(UpdatePipelineResponseProto);
rpc getDelegationToken(GetDelegationTokenRequestProto)
returns(GetDelegationTokenResponseProto);
rpc renewDelegationToken(RenewDelegationTokenRequestProto)
returns(RenewDelegationTokenResponseProto);
rpc cancelDelegationToken(CancelDelegationTokenRequestProto)
returns(CancelDelegationTokenResponseProto);
rpc setBalancerBandwidth(SetBalancerBandwidthRequestProto)
returns(SetBalancerBandwidthResponseProto);
}