public static boolean isFormatCorrect ( String fileName , ReadOnlyStorageFormat format ) { switch ( format ) { case READONLY_V0 : case READONLY_V1 : if ( fileName . matches ( "^[\\d]+_[\\d]+\\.(data|index)" ) ) { return true ; } else { return false ; } case READONLY_V2 : if ( fileName . matches ( "^[\\d]+_[\\d]+_[\\d]+\\.(data|index)" ) ) { return true ; } else { return false ; } default : throw new VoldemortException ( "Format type not supported" ) ; } }
Given a file name and read - only storage format tells whether the file name format is correct