class SyncStatusTracker {

    public void update(final String leaderId, final long leaderCommit, final long commitIndex) {
        requireNonNull(leaderId, "leaderId should not be null");

        if (syncTarget == null || !leaderId.equals(syncTarget.leaderId)) {
            LOG.debug("{}: Last sync leader does not match current leader {}, need to catch up to {}", id,
                leaderId, leaderCommit);
            changeSyncStatus(NOT_IN_SYNC, true);
            syncTarget = new LeaderInfo(leaderId, leaderCommit);
            return;
        }

        final long lag = leaderCommit - commitIndex;
        if (lag > syncThreshold) {
            LOG.debug("{}: Lagging {} entries behind leader {}", id, lag, leaderId);
            changeSyncStatus(NOT_IN_SYNC, false);
        } else if (commitIndex >= syncTarget.minimumCommitIndex) {
            LOG.debug("{}: Lagging {} entries behind leader {} and reached {} (of expected {})", id, lag, leaderId,
                commitIndex, syncTarget.minimumCommitIndex);
            changeSyncStatus(IN_SYNC, false);
        }
    }

    public  SyncStatusTracker(final ActorRef actor, final String id, final long syncThreshold);

}