Class StatusAnalyzer

java.lang.Object
org.kendar.sync.lib.twoway.StatusAnalyzer

public class StatusAnalyzer extends Object
StatusAnalyzer monitors files in a base directory and tracks changes for two-way synchronization between client and server.
  • Constructor Details

    • StatusAnalyzer

      public StatusAnalyzer(String baseDirectory)
  • Method Details

    • analyze

      public List<LogEntry> analyze() throws IOException
      Analyzes the directory and updates log files with changes since the last run
      Returns:
      List of detected changes as LogEntry objects
      Throws:
      IOException
    • compact

      public void compact() throws IOException
      Compacts the operation.log file by keeping only the latest "CR" operations and creates a .lastcompact.log with the timestamp of the operation
      Throws:
      IOException
    • compare

      public SyncActions compare(Path otherLogPath) throws IOException
      Compares two operation.log files and determines synchronization actions
      Parameters:
      otherLogPath - Path to the other operation.log file
      Returns:
      SyncActions containing lists of files to update/delete
      Throws:
      IOException
    • compare

      public SyncActions compare(Map<String,LogEntry> remoteOperations) throws IOException
      Throws:
      IOException
    • getLastCompactTime

      public Optional<Instant> getLastCompactTime()
      Returns the last compact time from the log file
    • getLastUpdateTime

      public Optional<Instant> getLastUpdateTime()
      Returns the last update time from the log file