public DatanodeInfoWithStorage(DatanodeInfo from, string storageID, StorageType storageType ) : base(from) { this.storageID = storageID; this.storageType = storageType; SetSoftwareVersion(from.GetSoftwareVersion()); SetDependentHostNames(from.GetDependentHostNames()); SetLevel(from.GetLevel()); SetParent(from.GetParent()); }
public DatanodeInfo(DatanodeInfo from) : base(from) { this.capacity = from.GetCapacity(); this.dfsUsed = from.GetDfsUsed(); this.remaining = from.GetRemaining(); this.blockPoolUsed = from.GetBlockPoolUsed(); this.cacheCapacity = from.GetCacheCapacity(); this.cacheUsed = from.GetCacheUsed(); this.lastUpdate = from.GetLastUpdate(); this.lastUpdateMonotonic = from.GetLastUpdateMonotonic(); this.xceiverCount = from.GetXceiverCount(); this.location = from.GetNetworkLocation(); this.adminState = from.GetAdminState(); }
public LocatedBlock(ExtendedBlock b, DatanodeInfo[] locs, string[] storageIDs, StorageType [] storageTypes, long startOffset, bool corrupt, DatanodeInfo[] cachedLocs) { // offset of the first byte of the block in the file // corrupt flag is true if all of the replicas of a block are corrupt. // else false. If block has few corrupt replicas, they are filtered and // their locations are not part of this object // Used when there are no locations // startOffset is unknown // startOffset is unknown // startOffset is unknown this.b = b; this.offset = startOffset; this.corrupt = corrupt; if (locs == null) { this.locs = EmptyLocs; } else { this.locs = new DatanodeInfoWithStorage[locs.Length]; for (int i = 0; i < locs.Length; i++) { DatanodeInfo di = locs[i]; DatanodeInfoWithStorage storage = new DatanodeInfoWithStorage(di, storageIDs != null ? storageIDs[i] : null, storageTypes != null ? storageTypes[i] : null); this.locs[i] = storage; } } this.storageIDs = storageIDs; this.storageTypes = storageTypes; if (cachedLocs == null || cachedLocs.Length == 0) { this.cachedLocs = EmptyLocs; } else { this.cachedLocs = cachedLocs; } }
/// <summary>Add a the location of a cached replica of the block.</summary> /// <param name="loc">of datanode with the cached replica</param> public virtual void AddCachedLoc(DatanodeInfo loc) { IList <DatanodeInfo> cachedList = Lists.NewArrayList(cachedLocs); if (cachedList.Contains(loc)) { return; } // Try to re-use a DatanodeInfo already in loc foreach (DatanodeInfoWithStorage di in locs) { if (loc.Equals(di)) { cachedList.AddItem(di); cachedLocs = Sharpen.Collections.ToArray(cachedList, cachedLocs); return; } } // Not present in loc, add it and go cachedList.AddItem(loc); cachedLocs = Sharpen.Collections.ToArray(cachedList, cachedLocs); }
/// <summary> /// The exception is thrown if a different data-node claims the same /// storage id as the existing one. /// </summary> /// <param name="nodeID">unregistered data-node</param> /// <param name="storedNode">data-node stored in the system with this storage id</param> public UnregisteredNodeException(DatanodeID nodeID, DatanodeInfo storedNode) : base("Data node " + nodeID + " is attempting to report storage ID " + nodeID.GetDatanodeUuid () + ". Node " + storedNode + " is expected to serve this storage.") { }