public static boolean shouldEncryptFile()

in encryption/src/main/java/org/apache/solr/encryption/kms/KmsKeySupplier.java [112:129]


    public static boolean shouldEncryptFile(String fileName) {
        String extension = IndexFileNames.getExtension(fileName);
        if (extension == null) {
            // segments and pending_segments are never passed as parameter of this method.
            assert !fileName.startsWith(IndexFileNames.SEGMENTS) && !fileName.startsWith(IndexFileNames.PENDING_SEGMENTS);
        } else if (CLEARTEXT_EXTENSIONS.contains(extension)) {
            // The file extension tells us it does not need to be encrypted.
            return false;
        } else if (extension.equals(TMP_EXTENSION)) {
            // We know some tmp files do not need to be encrypted.
            int tmpCounterIndex = fileName.lastIndexOf('_');
            assert tmpCounterIndex != -1;
            return !endsWith(fileName, TMP_DOC_IDS, tmpCounterIndex)
                    && !endsWith(fileName, TMP_FILE_POINTERS, tmpCounterIndex);
        }
        // By default, all other files should be encrypted.
        return true;
    }