Example #1
0
        public BalanceService(
            IBalanceRepository balanceRepository,
            ILogFactory logFactory,
            ICopyOptions options)

            : this(balanceRepository, logFactory, (IMigrateOptions)options)
        {
        }
Example #2
0
        private async static Task <int> StartJobsOrWork(ICopyOptions opts, string[] args)
        {
            Log.QuietMode = opts.Quiet();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            try
            {
                if (opts.Batch())
                {
                    switch (opts)
                    {
                    case CopyLocalToAzureFilesOptions f:
                        IWork filework = new CopyLocalStorageToAzureFiles(f);
                        Log.Always("starting Copy Local to Azure Files worker job");
                        await filework.StartAsync().ConfigureAwait(false);

                        break;

                    case CopyLocalToAzureBlobOptions b:
                        IWork blobwork = new CopyLocalStorageToAzureBlob(b);
                        Log.Always("starting Copy Local to Azure Blob worker job");
                        await blobwork.StartAsync().ConfigureAwait(false);

                        break;

                    default:
                        throw new Exception("unknown copy type");
                    }
                }
                else
                {
                    for (int jobNum = 0; jobNum < opts.Workers(); jobNum++)
                    {
                        try
                        {
                            Log.Always("starting worker " + jobNum);
                            StartNewProcessWithJob(args, jobNum, opts.NumFileRunnersPerQueue());
                        }
                        catch (Exception e)
                        {
                            Log.Always(e.Message);
                        }
                    }
                }
                StartMonitor(opts.Workers());
                sw.Stop();
                Log.Always(FixedStrings.FinishedJob + (sw.ElapsedMilliseconds / 1000) + FixedStrings.Seconds);
            }
            catch (Exception outerCatch)
            {
                Log.Always(outerCatch.Message);
                Log.Always(outerCatch.StackTrace);
            }
            Console.ReadKey();
            return(0);
        }
Example #3
0
 public CopyStrategy(
     IBalanceService balanceService,
     ILogFactory logFactory,
     IMatchingEngineClient meClient,
     IMigrationRepository migrationRepository,
     ICopyOptions options)
 {
     _balanceService      = balanceService;
     _log                 = logFactory.CreateLog(this);
     _meClient            = meClient;
     _migrationRepository = migrationRepository;
     _options             = options;
 }