/// <summary> /// Get a list of the datanodes which this block is cached, /// planned to be cached, or planned to be uncached on. /// </summary> /// <param name="type"> /// If null, this parameter is ignored. /// If it is non-null, we match only datanodes which /// have it on this list. /// See /// <see cref="Org.Apache.Hadoop.Hdfs.Server.Blockmanagement.DatanodeDescriptor.CachedBlocksList.Type /// "/> /// for a description of all the lists. /// </param> /// <returns> /// The list of datanodes. Modifying this list does not /// alter the state of the CachedBlock. /// </returns> public IList <DatanodeDescriptor> GetDatanodes(DatanodeDescriptor.CachedBlocksList.Type type) { IList <DatanodeDescriptor> nodes = new List <DatanodeDescriptor>(); for (int i = 0; i < triplets.Length; i += 3) { DatanodeDescriptor.CachedBlocksList list = (DatanodeDescriptor.CachedBlocksList)triplets [i]; if ((type == null) || (list.GetType() == type)) { nodes.AddItem(list.GetDatanode()); } } return(nodes); }
internal CachedBlocksList(DatanodeDescriptor datanode, DatanodeDescriptor.CachedBlocksList.Type type) { this.datanode = datanode; this.type = type; }