private UfsStatus [ ] getChildrenInUFS ( AlluxioURI alluxioUri ) throws InvalidPathException , IOException { MountTable . Resolution resolution = mMountTable . resolve ( alluxioUri ) ; AlluxioURI ufsUri = resolution . getUri ( ) ; try ( CloseableResource < UnderFileSystem > ufsResource = resolution . acquireUfsResource ( ) ) { UnderFileSystem ufs = ufsResource . get ( ) ; AlluxioURI curUri = ufsUri ; while ( curUri != null ) { if ( mListedDirectories . containsKey ( curUri . toString ( ) ) ) { List < UfsStatus > childrenList = new ArrayList <> ( ) ; for ( UfsStatus childStatus : mListedDirectories . get ( curUri . toString ( ) ) ) { String childPath = PathUtils . concatPath ( curUri , childStatus . getName ( ) ) ; String prefix = PathUtils . normalizePath ( ufsUri . toString ( ) , AlluxioURI . SEPARATOR ) ; if ( childPath . startsWith ( prefix ) && childPath . length ( ) > prefix . length ( ) ) { UfsStatus newStatus = childStatus . copy ( ) ; newStatus . setName ( childPath . substring ( prefix . length ( ) ) ) ; childrenList . add ( newStatus ) ; } } return trimIndirect ( childrenList . toArray ( new UfsStatus [ childrenList . size ( ) ] ) ) ; } curUri = curUri . getParent ( ) ; } UfsStatus [ ] children = ufs . listStatus ( ufsUri . toString ( ) , ListOptions . defaults ( ) . setRecursive ( true ) ) ; // Assumption: multiple mounted UFSs cannot have the same ufsUri if ( children == null ) { return EMPTY_CHILDREN ; } mListedDirectories . put ( ufsUri . toString ( ) , children ) ; return trimIndirect ( children ) ; } }
Get the children in under storage for given alluxio path .