Package io.debezium.connector.cassandra
Class CommitLogUtil
- java.lang.Object
-
- io.debezium.connector.cassandra.CommitLogUtil
-
public final class CommitLogUtil extends Object
Utility class used by theCommitLogProcessorto compare/delete commit log files.
-
-
Field Summary
Fields Modifier and Type Field Description private static PatternFILENAME_REGEX_PATTERNprivate static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description privateCommitLogUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompareCommitLogs(File file1, File file2)Comparing two commit log files provided theFileinstances; Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.static intcompareCommitLogs(String filename1, String filename2)Comparing two commit log files provided the file names.static booleandeleteCommitLog(File file)Delete a commit log and logs the error in the case the deletion failed.private static longextractTimestamp(String commitLogFileName)static File[]getCommitLogs(File directory)Given a directory, return an array of commit logs in this directory.static booleanmoveCommitLog(File file, Path toDir)Move a commit log to a new directory.
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
FILENAME_REGEX_PATTERN
private static final Pattern FILENAME_REGEX_PATTERN
-
-
Method Detail
-
moveCommitLog
public static boolean moveCommitLog(File file, Path toDir)
Move a commit log to a new directory. If the commit log already exists in the new directory, it woull be replaced.
-
deleteCommitLog
public static boolean deleteCommitLog(File file)
Delete a commit log and logs the error in the case the deletion failed.
-
getCommitLogs
public static File[] getCommitLogs(File directory)
Given a directory, return an array of commit logs in this directory. If the directory does not contain any commit logs, an empty array is returned.
-
compareCommitLogs
public static int compareCommitLogs(File file1, File file2)
Comparing two commit log files provided theFileinstances; Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
-
compareCommitLogs
public static int compareCommitLogs(String filename1, String filename2)
Comparing two commit log files provided the file names. Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
-
extractTimestamp
private static long extractTimestamp(String commitLogFileName)
-
-