src/main/java/org/apache/hadoop/hdfs/server/namenode/cache/CachedFileTypes.java
public void analyze(NameNodeLoader loader, Collection<INode> files) {
    /* If there is no namesystem (static testing), then exit. */
    if (loader.getCurrentTxId() == -1L) {
      return;
    }

    final QueryEngine queryEngine = loader.getQueryEngine();
    final Map<String, Map<String, Long>> fileTypeDiskspaceUsers =
        queryEngine.genericTwoLevelHistogram(
            files.parallelStream(),
            INode::getUserName,
            queryEngine.getGroupingFunctionToStringForINode("fileType", null, null),
            queryEngine.getSumFunctionForINode("diskspaceConsumed", null));
    final Map<String, Map<String, Long>> fileTypeCountUsers =
        queryEngine.genericTwoLevelHistogram(
            files.parallelStream(),
            INode::getUserName,
            queryEngine.getGroupingFunctionToStringForINode("fileType", null, null),
            queryEngine.getSumFunctionForINode("count", null));
    cachedUserFileTypeCount.clear();
    cachedUserFileTypeDiskspace.clear();
    for (Entry<String, Map<String, Long>> entry : fileTypeCountUsers.entrySet()) {
      cachedUserFileTypeCount.put(entry.getKey(), entry.getValue());
    }
    for (Entry<String, Map<String, Long>> entry : fileTypeDiskspaceUsers.entrySet()) {
      cachedUserFileTypeDiskspace.put(entry.getKey(), entry.getValue());
    }
  }
/**
   * Main analysis call for compute all quotas and quota usage information.
   *
   * @param loader the nn loader
   * @param files set of inode files
   */
Main analysis call for compute all quotas and quota usage information.
@param loader the nn loader
@param files set of inode files
Main analysis call for compute all quotas and quota usage information . @param loader the nn loader @param files set of inode files
public void analyze(NameNodeLoader loader, Collection<INode> files) {
    /* If there is no namesystem (static testing), then exit. */
    if (loader.getCurrentTxId() == -1L) {
      return;
    }
    final QueryEngine queryEngine = loader.getQueryEngine();
    final Map<String, Map<String, Long>> fileTypeDiskspaceUsers =
        queryEngine.genericTwoLevelHistogram(
            files.parallelStream(),
            INode::getUserName,
            queryEngine.getGroupingFunctionToStringForINode("fileType", null, null),
            queryEngine.getSumFunctionForINode("diskspaceConsumed", null));
    final Map<String, Map<String, Long>> fileTypeCountUsers =
        queryEngine.genericTwoLevelHistogram(
            files.parallelStream(),
            INode::getUserName,
            queryEngine.getGroupingFunctionToStringForINode("fileType", null, null),
            queryEngine.getSumFunctionForINode("count", null));
    cachedUserFileTypeCount.clear();
    cachedUserFileTypeDiskspace.clear();
    for (Entry<String, Map<String, Long>> entry : fileTypeCountUsers.entrySet()) {
      cachedUserFileTypeCount.put(entry.getKey(), entry.getValue());
    }
    for (Entry<String, Map<String, Long>> entry : fileTypeDiskspaceUsers.entrySet()) {
      cachedUserFileTypeDiskspace.put(entry.getKey(), entry.getValue());
    }
  }
public void analyze ( NameNodeLoader loader , Collection < INode > files ) { /* If there is no namesystem (static testing), then exit. */ if ( loader . getCurrentTxId ( ) == - 1L ) { return ; } final QueryEngine queryEngine = loader . getQueryEngine ( ) ; final Map < String , Map < String , Long > > fileTypeDiskspaceUsers = queryEngine . genericTwoLevelHistogram ( files . parallelStream ( ) , INode :: getUserName , queryEngine . getGroupingFunctionToStringForINode ( "fileType" , null , null ) , queryEngine . getSumFunctionForINode ( "diskspaceConsumed" , null ) ) ; final Map < String , Map < String , Long > > fileTypeCountUsers = queryEngine . genericTwoLevelHistogram ( files . parallelStream ( ) , INode :: getUserName , queryEngine . getGroupingFunctionToStringForINode ( "fileType" , null , null ) , queryEngine . getSumFunctionForINode ( "count" , null ) ) ; cachedUserFileTypeCount . clear ( ) ; cachedUserFileTypeDiskspace . clear ( ) ; for ( Entry < String , Map < String , Long > > entry : fileTypeCountUsers . entrySet ( ) ) { cachedUserFileTypeCount . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } for ( Entry < String , Map < String , Long > > entry : fileTypeDiskspaceUsers . entrySet ( ) ) { cachedUserFileTypeDiskspace . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } }
Main analysis call for compute all quotas and quota usage information.
Main analysis call for compute all quotas and quota usage information .