Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/MongoDB.Driver/Core/Bindings/ChannelChannelSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

using System;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand Down Expand Up @@ -64,13 +63,13 @@ public void Dispose()
}
}

public IChannelHandle GetChannel(CancellationToken cancellationToken)
public IChannelHandle GetChannel(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetChannelHelper();
}

public Task<IChannelHandle> GetChannelAsync(CancellationToken cancellationToken)
public Task<IChannelHandle> GetChannelAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult(GetChannelHelper());
Expand Down
13 changes: 6 additions & 7 deletions src/MongoDB.Driver/Core/Bindings/ChannelReadBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand Down Expand Up @@ -58,26 +57,26 @@ public void Dispose()
}
}

public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetReadChannelSourceHelper();
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult<IChannelSourceHandle>(GetReadChannelSourceHelper());
}

public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSource(cancellationToken);
return GetReadChannelSource(cancellationContext);
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSourceAsync(cancellationToken);
return GetReadChannelSourceAsync(cancellationContext);
}

private IChannelSourceHandle GetReadChannelSourceHelper()
Expand Down
41 changes: 20 additions & 21 deletions src/MongoDB.Driver/Core/Bindings/ChannelReadWriteBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand Down Expand Up @@ -56,68 +55,68 @@ public void Dispose()
}
}

public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetChannelSourceHelper();
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult(GetChannelSourceHelper());
}

public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSource(cancellationToken);
return GetReadChannelSource(cancellationContext);
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSourceAsync(cancellationToken);
return GetReadChannelSourceAsync(cancellationContext);
}

public IChannelSourceHandle GetWriteChannelSource(CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetChannelSourceHelper();
}

public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(cancellationToken);
return GetWriteChannelSource(cancellationContext);
}

public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(cancellationToken); // ignore mayUseSecondary
return GetWriteChannelSource(cancellationContext); // ignore mayUseSecondary
}

public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(mayUseSecondary, cancellationToken);
return GetWriteChannelSource(mayUseSecondary, cancellationContext);
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult(GetChannelSourceHelper());
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(cancellationToken);
return GetWriteChannelSourceAsync(cancellationContext);
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(cancellationToken); // ignore mayUseSecondary
return GetWriteChannelSourceAsync(cancellationContext); // ignore mayUseSecondary
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationToken);
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationContext);
}

private IChannelSourceHandle GetChannelSourceHelper()
Expand Down
9 changes: 4 additions & 5 deletions src/MongoDB.Driver/Core/Bindings/ChannelSourceHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

using System;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand Down Expand Up @@ -55,16 +54,16 @@ public ICoreSessionHandle Session
}

// methods
public IChannelHandle GetChannel(CancellationToken cancellationToken)
public IChannelHandle GetChannel(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return _reference.Instance.GetChannel(cancellationToken);
return _reference.Instance.GetChannel(cancellationContext);
}

public Task<IChannelHandle> GetChannelAsync(CancellationToken cancellationToken)
public Task<IChannelHandle> GetChannelAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return _reference.Instance.GetChannelAsync(cancellationToken);
return _reference.Instance.GetChannelAsync(cancellationContext);
}

public void Dispose()
Expand Down
41 changes: 20 additions & 21 deletions src/MongoDB.Driver/Core/Bindings/ChannelSourceReadWriteBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver.Core.Misc;
using MongoDB.Driver.Core.Servers;
Expand Down Expand Up @@ -46,68 +45,68 @@ public ICoreSessionHandle Session
get { return _session; }
}

public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetChannelSourceHelper();
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult(GetChannelSourceHelper());
}

public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSource(cancellationToken);
return GetReadChannelSource(cancellationContext);
}

public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetReadChannelSourceAsync(cancellationToken);
return GetReadChannelSourceAsync(cancellationContext);
}

public IChannelSourceHandle GetWriteChannelSource(CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return GetChannelSourceHelper();
}

public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(cancellationToken);
return GetWriteChannelSource(cancellationContext);
}

public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(cancellationToken); // ignore mayUseSecondary
return GetWriteChannelSource(cancellationContext); // ignore mayUseSecondary
}

public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSource(mayUseSecondary, cancellationToken);
return GetWriteChannelSource(mayUseSecondary, cancellationContext);
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationCancellationContext cancellationContext)
{
ThrowIfDisposed();
return Task.FromResult(GetChannelSourceHelper());
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(cancellationToken);
return GetWriteChannelSourceAsync(cancellationContext);
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(cancellationToken); // ignore mayUseSecondary
return GetWriteChannelSourceAsync(cancellationContext); // ignore mayUseSecondary
}

public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
{
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationToken);
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationContext);
}

public void Dispose()
Expand Down
Loading