public ServiceWorkerAdapter(IPushBroker <TNotification> broker, IPushConnection <INotification> connection) { Broker = broker; Connection = connection; CancelTokenSource = new CancellationTokenSource(); notifications = new BlockingCollection <TNotification>(); }
/// <summary> /// Perform push operation between local and remote repository - set remote /// refs appropriately, send needed objects and update local tracking refs. /// <para /> /// When <seealso cref="Transport.DryRun"/> is true, result of this operation is /// just estimation of real operation result, no real action is performed. /// </summary> /// <param name="monitor"> /// Progress monitor used for feedback about operation. /// </param> /// <returns> result of push operation with complete status description. </returns> /// <exception cref="NotSupportedException"> /// When push operation is not supported by provided transport. /// </exception> /// <exception cref="TransportException"> /// When some error occurred during operation, like I/O, protocol /// error, or local database consistency error. /// </exception> public PushResult execute(ProgressMonitor monitor) { monitor.BeginTask(PROGRESS_OPENING_CONNECTION, ProgressMonitor.UNKNOWN); _connection = _transport.openPush(); try { monitor.EndTask(); IDictionary <string, RemoteRefUpdate> preprocessed = PrepareRemoteUpdates(); if (_transport.DryRun) { ModifyUpdatesForDryRun(); } else if (preprocessed.Count != 0) { _connection.Push(monitor, preprocessed); } } finally { _connection.Close(); } if (!_transport.DryRun) { UpdateTrackingRefs(); } return(PrepareOperationResult()); }
public PushResult execute(ProgressMonitor monitor) { monitor.BeginTask(PROGRESS_OPENING_CONNECTION, -1); connection = transport.openPush(); try { monitor.EndTask(); Dictionary<string, RemoteRefUpdate> preprocessed = prepareRemoteUpdates(); if (transport.DryRun) modifyUpdatesForDryRun(); else if (preprocessed.Count != 0) connection.Push(monitor, preprocessed); } finally { connection.Close(); } if (!transport.DryRun) updateTrackingRefs(); return prepareOperationResult(); }
/// <summary> /// Perform push operation between local and remote repository - set remote /// refs appropriately, send needed objects and update local tracking refs. /// <para /> /// When <seealso cref="Transport.DryRun"/> is true, result of this operation is /// just estimation of real operation result, no real action is performed. /// </summary> /// <param name="monitor"> /// Progress monitor used for feedback about operation. /// </param> /// <returns> result of push operation with complete status description. </returns> /// <exception cref="NotSupportedException"> /// When push operation is not supported by provided transport. /// </exception> /// <exception cref="TransportException"> /// When some error occurred during operation, like I/O, protocol /// error, or local database consistency error. /// </exception> public PushResult execute(ProgressMonitor monitor) { if (monitor == null) throw new ArgumentNullException("monitor"); monitor.BeginTask(PROGRESS_OPENING_CONNECTION, ProgressMonitor.UNKNOWN); _connection = _transport.openPush(); try { monitor.EndTask(); IDictionary<string, RemoteRefUpdate> preprocessed = PrepareRemoteUpdates(); if (_transport.DryRun) { ModifyUpdatesForDryRun(); } else if (preprocessed.Count != 0) { _connection.Push(monitor, preprocessed); } } finally { _connection.Close(); } if (!_transport.DryRun) { UpdateTrackingRefs(); } return PrepareOperationResult(); }