Class LogtailerFileCleaner

java.lang.Object
com.illumon.iris.db.tables.dataimport.logtailer.LogtailerFileCleaner
All Implemented Interfaces:
LogtailerDestinationManager.FinishedFileConsumer

public class LogtailerFileCleaner extends Object implements LogtailerDestinationManager.FinishedFileConsumer
Utility to passively collect binlog files, and delete them after a specified period of inactivity. Used to remove Logtailer binlog files that have been fully processed.
  • Constructor Details

    • LogtailerFileCleaner

      public LogtailerFileCleaner(@NotNull com.fishlib.io.logger.Logger log, int deleteAfterMinutes, int timerPeriodMinutes, boolean enabled, DataRoutingService routingService)
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • handleFile

      public void handleFile(@NotNull File finishedFile, @NotNull TableLocationIdentifier tableLocationIdentifier, @NotNull String endpointName)
      Description copied from interface: LogtailerDestinationManager.FinishedFileConsumer
      LogtailerDestinationManager instances post old files that are no longer gathering data to this interface, along with the identifier for its target table and a description of the endpoint to which the data is sent. It is possible for one file to be sent to multiple endpoints, and files must not be deleted until all endpoints have processed the file.
      Specified by:
      handleFile in interface LogtailerDestinationManager.FinishedFileConsumer
      Parameters:
      finishedFile - File which has been fully processed that can be deleted.
      tableLocationIdentifier - Identifier for the table to which this file's data is sent.
      endpointName - Unique identifier of the endpoint to which the file was sent.
    • hasRun

      @VisibleForTesting public boolean hasRun()
      For unit testing. To ensure that the timer ran at least once before making assertions.
      Returns:
      True iff the timer thread has made at least one attempt at file cleanup.