class OfferSyncProcess {

    public void synchronize(ExecutorService executor, String sourceOffer, String targetOffer, String strategyId,
        DataCategory dataCategory, Long startOffset) {

        this.offerSyncStatus = new OfferSyncStatus(
            VitamThreadUtils.getVitamSession().getRequestId(), StatusCode.UNKNOWN, getCurrentDate(), null,
            sourceOffer, targetOffer, dataCategory.getCollectionName(), startOffset, null);

        try {
            LOGGER.info(String.format(
                "Start the synchronization process of the target offer {%s} from the source offer {%s} for category {%s}.",
                targetOffer, sourceOffer, dataCategory));

            Long offset = startOffset;
            while (true) {
                // get the data to startSynchronization
                List<OfferLog> rawOfferLogs = restoreOfferBackupService.getListing(
                    strategyId, sourceOffer, dataCategory, offset, bulkSize, Order.ASC);

                if (rawOfferLogs.isEmpty()) {
                    break;
                }

                long lastSequence =
                    synchronizeOfferLogs(executor, sourceOffer, targetOffer, strategyId, dataCategory, rawOfferLogs,
                        offset);

                this.offerSyncStatus.setCurrentOffset(lastSequence);

                offset = lastSequence + 1;

                LOGGER
                    .info(String.format("Offer synchronization safe point offset : %s (from %s to %s for category %s)",
                        offset, sourceOffer, targetOffer, dataCategory));

                if (rawOfferLogs.size() < bulkSize) {
                    break;
                }
            }

            LOGGER.info(String.format("The offers synchronization completed successfully. from %d to %d",
                startOffset, offset));
            this.offerSyncStatus.setStatusCode(StatusCode.OK);

        } catch (Exception e) {
            this.offerSyncStatus.setStatusCode(StatusCode.KO);
            LOGGER.error(String.format(
                "[OfferSync]: An exception has been thrown when synchronizing {%s} offer from {%s} source offer with {%s} offset.",
                targetOffer, sourceOffer, startOffset), e);
        } finally {
            this.offerSyncStatus.setEndDate(getCurrentDate());
        }
    }

    public  OfferSyncProcess(RestoreOfferBackupService restoreOfferBackupService, StorageDistribution distribution,
        int bulkSize, int offerSyncNumberOfRetries, int offerSyncFirstAttemptWaitingTime,
        int offerSyncWaitingTime);

}