@ Nullable public static StorageDirView selectDirWithRequestedSpace ( long bytesToBeAvailable , BlockStoreLocation location , BlockMetadataManagerView mManagerView ) { if ( location . equals ( BlockStoreLocation . anyTier ( ) ) ) { for ( StorageTierView tierView : mManagerView . getTierViews ( ) ) { for ( StorageDirView dirView : tierView . getDirViews ( ) ) { if ( dirView . getAvailableBytes ( ) >= bytesToBeAvailable ) { return dirView ; } } } return null ; } String tierAlias = location . tierAlias ( ) ; StorageTierView tierView = mManagerView . getTierView ( tierAlias ) ; if ( location . equals ( BlockStoreLocation . anyDirInTier ( tierAlias ) ) ) { for ( StorageDirView dirView : tierView . getDirViews ( ) ) { if ( dirView . getAvailableBytes ( ) >= bytesToBeAvailable ) { return dirView ; } } return null ; } StorageDirView dirView = tierView . getDirView ( location . dir ( ) ) ; return ( dirView . getAvailableBytes ( ) >= bytesToBeAvailable ) ? dirView : null ; }
Finds a directory in the given location range with capacity upwards of the given bound .