Skip to content

Commit 6f38b2a

Browse files
author
Oleksandr Poliakov
committed
Rename OperationCancellationContext to OperationContext
1 parent de8c0ce commit 6f38b2a

File tree

129 files changed

+1233
-1235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1233
-1235
lines changed

src/MongoDB.Driver/Core/Bindings/ChannelChannelSource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public void Dispose()
6363
}
6464
}
6565

66-
public IChannelHandle GetChannel(OperationCancellationContext cancellationContext)
66+
public IChannelHandle GetChannel(OperationContext operationContext)
6767
{
6868
ThrowIfDisposed();
6969
return GetChannelHelper();
7070
}
7171

72-
public Task<IChannelHandle> GetChannelAsync(OperationCancellationContext cancellationContext)
72+
public Task<IChannelHandle> GetChannelAsync(OperationContext operationContext)
7373
{
7474
ThrowIfDisposed();
7575
return Task.FromResult(GetChannelHelper());

src/MongoDB.Driver/Core/Bindings/ChannelReadBinding.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,26 @@ public void Dispose()
5757
}
5858
}
5959

60-
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
60+
public IChannelSourceHandle GetReadChannelSource(OperationContext operationContext)
6161
{
6262
ThrowIfDisposed();
6363
return GetReadChannelSourceHelper();
6464
}
6565

66-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
66+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationContext operationContext)
6767
{
6868
ThrowIfDisposed();
6969
return Task.FromResult<IChannelSourceHandle>(GetReadChannelSourceHelper());
7070
}
7171

72-
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
72+
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
7373
{
74-
return GetReadChannelSource(cancellationContext);
74+
return GetReadChannelSource(operationContext);
7575
}
7676

77-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
77+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
7878
{
79-
return GetReadChannelSourceAsync(cancellationContext);
79+
return GetReadChannelSourceAsync(operationContext);
8080
}
8181

8282
private IChannelSourceHandle GetReadChannelSourceHelper()

src/MongoDB.Driver/Core/Bindings/ChannelReadWriteBinding.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,68 +55,68 @@ public void Dispose()
5555
}
5656
}
5757

58-
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
58+
public IChannelSourceHandle GetReadChannelSource(OperationContext operationContext)
5959
{
6060
ThrowIfDisposed();
6161
return GetChannelSourceHelper();
6262
}
6363

64-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
64+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationContext operationContext)
6565
{
6666
ThrowIfDisposed();
6767
return Task.FromResult(GetChannelSourceHelper());
6868
}
6969

70-
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
70+
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
7171
{
72-
return GetReadChannelSource(cancellationContext);
72+
return GetReadChannelSource(operationContext);
7373
}
7474

75-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
75+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
7676
{
77-
return GetReadChannelSourceAsync(cancellationContext);
77+
return GetReadChannelSourceAsync(operationContext);
7878
}
7979

80-
public IChannelSourceHandle GetWriteChannelSource(OperationCancellationContext cancellationContext)
80+
public IChannelSourceHandle GetWriteChannelSource(OperationContext operationContext)
8181
{
8282
ThrowIfDisposed();
8383
return GetChannelSourceHelper();
8484
}
8585

86-
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
86+
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
8787
{
88-
return GetWriteChannelSource(cancellationContext);
88+
return GetWriteChannelSource(operationContext);
8989
}
9090

91-
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
91+
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
9292
{
93-
return GetWriteChannelSource(cancellationContext); // ignore mayUseSecondary
93+
return GetWriteChannelSource(operationContext); // ignore mayUseSecondary
9494
}
9595

96-
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
96+
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
9797
{
98-
return GetWriteChannelSource(mayUseSecondary, cancellationContext);
98+
return GetWriteChannelSource(mayUseSecondary, operationContext);
9999
}
100100

101-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationCancellationContext cancellationContext)
101+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationContext operationContext)
102102
{
103103
ThrowIfDisposed();
104104
return Task.FromResult(GetChannelSourceHelper());
105105
}
106106

107-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
107+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
108108
{
109-
return GetWriteChannelSourceAsync(cancellationContext);
109+
return GetWriteChannelSourceAsync(operationContext);
110110
}
111111

112-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
112+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
113113
{
114-
return GetWriteChannelSourceAsync(cancellationContext); // ignore mayUseSecondary
114+
return GetWriteChannelSourceAsync(operationContext); // ignore mayUseSecondary
115115
}
116116

117-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
117+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
118118
{
119-
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationContext);
119+
return GetWriteChannelSourceAsync(mayUseSecondary, operationContext);
120120
}
121121

122122
private IChannelSourceHandle GetChannelSourceHelper()

src/MongoDB.Driver/Core/Bindings/ChannelSourceHandle.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ public ICoreSessionHandle Session
5454
}
5555

5656
// methods
57-
public IChannelHandle GetChannel(OperationCancellationContext cancellationContext)
57+
public IChannelHandle GetChannel(OperationContext operationContext)
5858
{
5959
ThrowIfDisposed();
60-
return _reference.Instance.GetChannel(cancellationContext);
60+
return _reference.Instance.GetChannel(operationContext);
6161
}
6262

63-
public Task<IChannelHandle> GetChannelAsync(OperationCancellationContext cancellationContext)
63+
public Task<IChannelHandle> GetChannelAsync(OperationContext operationContext)
6464
{
6565
ThrowIfDisposed();
66-
return _reference.Instance.GetChannelAsync(cancellationContext);
66+
return _reference.Instance.GetChannelAsync(operationContext);
6767
}
6868

6969
public void Dispose()

src/MongoDB.Driver/Core/Bindings/ChannelSourceReadWriteBinding.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,68 +45,68 @@ public ICoreSessionHandle Session
4545
get { return _session; }
4646
}
4747

48-
public IChannelSourceHandle GetReadChannelSource(OperationCancellationContext cancellationContext)
48+
public IChannelSourceHandle GetReadChannelSource(OperationContext operationContext)
4949
{
5050
ThrowIfDisposed();
5151
return GetChannelSourceHelper();
5252
}
5353

54-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationCancellationContext cancellationContext)
54+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(OperationContext operationContext)
5555
{
5656
ThrowIfDisposed();
5757
return Task.FromResult(GetChannelSourceHelper());
5858
}
5959

60-
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
60+
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
6161
{
62-
return GetReadChannelSource(cancellationContext);
62+
return GetReadChannelSource(operationContext);
6363
}
6464

65-
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
65+
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
6666
{
67-
return GetReadChannelSourceAsync(cancellationContext);
67+
return GetReadChannelSourceAsync(operationContext);
6868
}
6969

70-
public IChannelSourceHandle GetWriteChannelSource(OperationCancellationContext cancellationContext)
70+
public IChannelSourceHandle GetWriteChannelSource(OperationContext operationContext)
7171
{
7272
ThrowIfDisposed();
7373
return GetChannelSourceHelper();
7474
}
7575

76-
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
76+
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
7777
{
78-
return GetWriteChannelSource(cancellationContext);
78+
return GetWriteChannelSource(operationContext);
7979
}
8080

81-
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
81+
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
8282
{
83-
return GetWriteChannelSource(cancellationContext); // ignore mayUseSecondary
83+
return GetWriteChannelSource(operationContext); // ignore mayUseSecondary
8484
}
8585

86-
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
86+
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
8787
{
88-
return GetWriteChannelSource(mayUseSecondary, cancellationContext);
88+
return GetWriteChannelSource(mayUseSecondary, operationContext);
8989
}
9090

91-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationCancellationContext cancellationContext)
91+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(OperationContext operationContext)
9292
{
9393
ThrowIfDisposed();
9494
return Task.FromResult(GetChannelSourceHelper());
9595
}
9696

97-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationCancellationContext cancellationContext)
97+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, OperationContext operationContext)
9898
{
99-
return GetWriteChannelSourceAsync(cancellationContext);
99+
return GetWriteChannelSourceAsync(operationContext);
100100
}
101101

102-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
102+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
103103
{
104-
return GetWriteChannelSourceAsync(cancellationContext); // ignore mayUseSecondary
104+
return GetWriteChannelSourceAsync(operationContext); // ignore mayUseSecondary
105105
}
106106

107-
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationCancellationContext cancellationContext)
107+
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, OperationContext operationContext)
108108
{
109-
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationContext);
109+
return GetWriteChannelSourceAsync(mayUseSecondary, operationContext);
110110
}
111111

112112
public void Dispose()

src/MongoDB.Driver/Core/Bindings/CoreSession.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public bool IsInTransaction
146146
EnsureAbortTransactionCanBeCalled(nameof(AbortTransaction));
147147

148148
// TODO: CSOT implement proper way to obtain the operationCancellationContext
149-
var operationCancellationContext = new OperationCancellationContext(Timeout.InfiniteTimeSpan, cancellationToken);
149+
var operationCancellationContext = new OperationContext(Timeout.InfiniteTimeSpan, cancellationToken);
150150
try
151151
{
152152
if (_currentTransaction.IsEmpty)
@@ -197,7 +197,7 @@ public bool IsInTransaction
197197
EnsureAbortTransactionCanBeCalled(nameof(AbortTransaction));
198198

199199
// TODO: CSOT implement proper way to obtain the operationCancellationContext
200-
var operationCancellationContext = new OperationCancellationContext(Timeout.InfiniteTimeSpan, cancellationToken);
200+
var operationCancellationContext = new OperationContext(Timeout.InfiniteTimeSpan, cancellationToken);
201201
try
202202
{
203203
if (_currentTransaction.IsEmpty)
@@ -297,7 +297,7 @@ public long AdvanceTransactionNumber()
297297
EnsureCommitTransactionCanBeCalled(nameof(CommitTransaction));
298298

299299
// TODO: CSOT implement proper way to obtain the operationCancellationContext
300-
var operationCancellationContext = new OperationCancellationContext(Timeout.InfiniteTimeSpan, cancellationToken);
300+
var operationCancellationContext = new OperationContext(Timeout.InfiniteTimeSpan, cancellationToken);
301301
try
302302
{
303303
_isCommitTransactionInProgress = true;
@@ -334,7 +334,7 @@ public long AdvanceTransactionNumber()
334334
EnsureCommitTransactionCanBeCalled(nameof(CommitTransaction));
335335

336336
// TODO: CSOT implement proper way to obtain the operationCancellationContext
337-
var operationCancellationContext = new OperationCancellationContext(Timeout.InfiniteTimeSpan, cancellationToken);
337+
var operationCancellationContext = new OperationContext(Timeout.InfiniteTimeSpan, cancellationToken);
338338
try
339339
{
340340
_isCommitTransactionInProgress = true;
@@ -545,21 +545,21 @@ private void EnsureTransactionsAreSupported()
545545
}
546546
}
547547

548-
private TResult ExecuteEndTransactionOnPrimary<TResult>(IReadOperation<TResult> operation, OperationCancellationContext operationCancellationContext)
548+
private TResult ExecuteEndTransactionOnPrimary<TResult>(IReadOperation<TResult> operation, OperationContext operationContext)
549549
{
550550
using (var sessionHandle = new NonDisposingCoreSessionHandle(this))
551551
using (var binding = ChannelPinningHelper.CreateReadWriteBinding(_cluster, sessionHandle))
552552
{
553-
return operation.Execute(binding, operationCancellationContext);
553+
return operation.Execute(binding, operationContext);
554554
}
555555
}
556556

557-
private async Task<TResult> ExecuteEndTransactionOnPrimaryAsync<TResult>(IReadOperation<TResult> operation, OperationCancellationContext operationCancellationContext)
557+
private async Task<TResult> ExecuteEndTransactionOnPrimaryAsync<TResult>(IReadOperation<TResult> operation, OperationContext operationContext)
558558
{
559559
using (var sessionHandle = new NonDisposingCoreSessionHandle(this))
560560
using (var binding = ChannelPinningHelper.CreateReadWriteBinding(_cluster, sessionHandle))
561561
{
562-
return await operation.ExecuteAsync(binding, operationCancellationContext).ConfigureAwait(false);
562+
return await operation.ExecuteAsync(binding, operationContext).ConfigureAwait(false);
563563
}
564564
}
565565

0 commit comments

Comments
 (0)