class ShardMigrationExecutor {

    public MigrateState executeAllOperations() {
        stopNetOperations();
        long start = System.currentTimeMillis();
        log.debug("START SHARDING...");
        MigrateState state = MigrateState.INIT;
        for (DataMigrateOperation dataMigrateOperation : dataMigrateOperations) {
            log.debug("Before execute {}", dataMigrateOperation);
            state = dataMigrateOperation.execute();
            log.debug("After execute step {} = '{}' before Fire Event...", dataMigrateOperation, state.name());
            migrateStateEvent.select(literal(state)).fire(state);
            if (state == MigrateState.FAILED) {
                log.warn("{} FAILED sharding...", dataMigrateOperation);
                break;
            }
        }
        log.debug("FINISHED SHARDING ----- '{}' in {} ms", state, System.currentTimeMillis() - start);
        resumeNetOperations();
        return state;
    }

    @Inject public  ShardMigrationExecutor(ShardEngine shardEngine,
                                  javax.enterprise.event.Event<MigrateState> migrateStateEvent,
                                  ShardHashCalculator shardHashCalculator,
                                  ShardDao shardDao,
                                  ExcludedTransactionDbIdExtractor excludedTransactionDbIdExtractor,
                                  PrevBlockInfoExtractor prevBlockInfoExtractor,
                                  DerivedTablesRegistry registry,
                                  BlockchainProcessor blockchainProcessor,
                                  PeersService peers,
                                  @Property(value = "apl.sharding.backupDb", defaultValue = "false") boolean backupDb);

}