Exemple #1
0
 public void Enqueue(IBackgroundTransfer backgroundTransfer)
 {
     lock (Queue)
     {
         Queue.Enqueue(new BackgroundTransferEntry(backgroundTransfer));
     }
 }
Exemple #2
0
 public BackgroundTransferEntry(
     [NotNull] IBackgroundTransfer backgroundTransfer,
     long sequenceNumber)
 {
     BackgroundTransfer = backgroundTransfer;
     SequenceNumber     = sequenceNumber;
     Status             = BackgroundTransferStatus.Enqueued;
 }
        public void AddOutProcess(Job job)
        {
            JobQueue.Enqueue(job);
            IBackgroundTransfer transfer = null;

#if __IOS__
            transfer = new BackgroundTransferTaskIOS();
#endif
            transfer.Init("com.test.job" + job.Id, job.Url, TransferTaskMode.Download);
            transfer.Start();
        }
Exemple #4
0
        /// <inheritdoc />
        public async Task EnqueueAsync(IBackgroundTransfer backgroundTransfer, CancellationToken cancellationToken)
        {
            var sequenceNumber = Interlocked.Increment(ref _sequenceNumber);
            var newEntry       = new BackgroundTransferEntry(backgroundTransfer, sequenceNumber);

            lock (_pendingOrActiveEntries)
            {
                _pendingOrActiveEntries.Add(newEntry.Id, newEntry);
            }

            await _channel.Writer
            .WriteAsync(newEntry, cancellationToken)
            .ConfigureAwait(false);
        }
Exemple #5
0
        /// <summary>
        /// Enqueue a new <see cref="IBackgroundTransfer"/> for the given <paramref name="connection"/>
        /// </summary>
        /// <param name="backgroundTransfer">The background transfer to enqueue</param>
        /// <param name="connection">The connection to enqueue the background transfer for</param>
        public void EnqueueBackgroundTransfer([NotNull] IBackgroundTransfer backgroundTransfer, [CanBeNull] FtpConnection connection)
        {
            var entry = new BackgroundTransferEntry(backgroundTransfer, connection?.Log);

            BackgroundTransferWorker.Enqueue(entry);
        }
 public BackgroundTransferEntry([NotNull] IBackgroundTransfer backgroundTransfer, [CanBeNull] ILogger log)
 {
     BackgroundTransfer = backgroundTransfer;
     Log    = log;
     Status = BackgroundTransferStatus.Enqueued;
 }
Exemple #7
0
        /// <inheritdoc />
        public void EnqueueBackgroundTransfer(IBackgroundTransfer backgroundTransfer, IFtpConnection connection)
        {
            var entry = new BackgroundTransferEntry(backgroundTransfer, connection?.Log);

            BackgroundTransferWorker.Enqueue(entry);
        }
Exemple #8
0
 public BackgroundTransferEntry([NotNull] IBackgroundTransfer backgroundTransfer)
 {
     BackgroundTransfer = backgroundTransfer;
     Status             = BackgroundTransferStatus.Enqueued;
 }