/// <exception cref="System.IO.IOException"/> public override void WriteBlock(ExtendedBlock blk, StorageType storageType, Org.Apache.Hadoop.Security.Token.Token <BlockTokenIdentifier> blockToken, string clientName, DatanodeInfo[] targets, StorageType [] targetStorageTypes, DatanodeInfo source, BlockConstructionStage stage, int pipelineSize , long minBytesRcvd, long maxBytesRcvd, long latestGenerationStamp, DataChecksum requestedChecksum, CachingStrategy cachingStrategy, bool allowLazyPersist, bool pinning, bool[] targetPinnings) { DataTransferProtos.ClientOperationHeaderProto header = DataTransferProtoUtil.BuildClientHeader (blk, clientName, blockToken); DataTransferProtos.ChecksumProto checksumProto = DataTransferProtoUtil.ToProto(requestedChecksum ); DataTransferProtos.OpWriteBlockProto.Builder proto = DataTransferProtos.OpWriteBlockProto .NewBuilder().SetHeader(header).SetStorageType(PBHelper.ConvertStorageType(storageType )).AddAllTargets(PBHelper.Convert(targets, 1)).AddAllTargetStorageTypes(PBHelper .ConvertStorageTypes(targetStorageTypes, 1)).SetStage(DataTransferProtoUtil.ToProto (stage)).SetPipelineSize(pipelineSize).SetMinBytesRcvd(minBytesRcvd).SetMaxBytesRcvd (maxBytesRcvd).SetLatestGenerationStamp(latestGenerationStamp).SetRequestedChecksum (checksumProto).SetCachingStrategy(GetCachingStrategy(cachingStrategy)).SetAllowLazyPersist (allowLazyPersist).SetPinning(pinning).AddAllTargetPinnings(PBHelper.Convert(targetPinnings , 1)); if (source != null) { proto.SetSource(PBHelper.ConvertDatanodeInfo(source)); } Send(@out, OP.WriteBlock, ((DataTransferProtos.OpWriteBlockProto)proto.Build())); }
/// <exception cref="System.IO.IOException"/> public override void ReadBlock(ExtendedBlock blk, Org.Apache.Hadoop.Security.Token.Token <BlockTokenIdentifier> blockToken, string clientName, long blockOffset, long length , bool sendChecksum, CachingStrategy cachingStrategy) { DataTransferProtos.OpReadBlockProto proto = ((DataTransferProtos.OpReadBlockProto )DataTransferProtos.OpReadBlockProto.NewBuilder().SetHeader(DataTransferProtoUtil .BuildClientHeader(blk, clientName, blockToken)).SetOffset(blockOffset).SetLen(length ).SetSendChecksums(sendChecksum).SetCachingStrategy(GetCachingStrategy(cachingStrategy )).Build()); Send(@out, OP.ReadBlock, proto); }
/// <exception cref="System.IO.IOException"/> public override void TransferBlock(ExtendedBlock blk, Org.Apache.Hadoop.Security.Token.Token <BlockTokenIdentifier> blockToken, string clientName, DatanodeInfo[] targets, StorageType [] targetStorageTypes) { DataTransferProtos.OpTransferBlockProto proto = ((DataTransferProtos.OpTransferBlockProto )DataTransferProtos.OpTransferBlockProto.NewBuilder().SetHeader(DataTransferProtoUtil .BuildClientHeader(blk, clientName, blockToken)).AddAllTargets(PBHelper.Convert( targets)).AddAllTargetStorageTypes(PBHelper.ConvertStorageTypes(targetStorageTypes )).Build()); Send(@out, OP.TransferBlock, proto); }