Skip to content

Commit ac2b2a6

Browse files
authored
CSHARP-5215: Hide Operations/IBinding APIs (#1406)
1 parent c547b03 commit ac2b2a6

File tree

113 files changed

+321
-6240
lines changed

Some content is hidden

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

113 files changed

+321
-6240
lines changed

CSharpDriver.sln

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
4444
MongoDBTest.ruleset = MongoDBTest.ruleset
4545
EndProjectSection
4646
EndProject
47-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDB.Driver.TestConsoleApplication", "tests\MongoDB.Driver.TestConsoleApplication\MongoDB.Driver.TestConsoleApplication.csproj", "{2E5780D2-29A5-483C-9CA2-844F45A66D0C}"
48-
EndProject
4947
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AstrolabeWorkloadExecutor", "tests\AstrolabeWorkloadExecutor\AstrolabeWorkloadExecutor.csproj", "{B90F025F-89D3-436A-AD78-6AA304A6E240}"
5048
EndProject
5149
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoDB.Driver.SmokeTests.Sdk", "tests\SmokeTests\MongoDB.Driver.SmokeTests.Sdk\MongoDB.Driver.SmokeTests.Sdk.csproj", "{B711A69F-A337-452C-95E1-A6B15C727CBA}"
@@ -106,10 +104,6 @@ Global
106104
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Debug|Any CPU.Build.0 = Debug|Any CPU
107105
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release|Any CPU.ActiveCfg = Release|Any CPU
108106
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release|Any CPU.Build.0 = Release|Any CPU
109-
{2E5780D2-29A5-483C-9CA2-844F45A66D0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110-
{2E5780D2-29A5-483C-9CA2-844F45A66D0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
111-
{2E5780D2-29A5-483C-9CA2-844F45A66D0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
112-
{2E5780D2-29A5-483C-9CA2-844F45A66D0C}.Release|Any CPU.Build.0 = Release|Any CPU
113107
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114108
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Debug|Any CPU.Build.0 = Debug|Any CPU
115109
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -145,7 +139,6 @@ Global
145139
{2CE8F5C4-DD44-4E32-A1D5-D86C47817E64} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
146140
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
147141
{C50D554C-2771-4CC1-9B2C-BB17FB27F935} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
148-
{2E5780D2-29A5-483C-9CA2-844F45A66D0C} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
149142
{B90F025F-89D3-436A-AD78-6AA304A6E240} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}
150143
{B711A69F-A337-452C-95E1-A6B15C727CBA} = {F64BF86A-1EF1-4596-84A6-6B4AB766CD77}
151144
{F64BF86A-1EF1-4596-84A6-6B4AB766CD77} = {E472BDF5-61F1-461D-872B-9F53BB3ACA80}

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

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,14 @@
2222

2323
namespace MongoDB.Driver.Core.Bindings
2424
{
25-
/// <summary>
26-
/// Represents a read binding that is bound to a channel.
27-
/// </summary>
28-
public sealed class ChannelReadBinding : IReadBinding
25+
internal sealed class ChannelReadBinding : IReadBinding
2926
{
30-
// fields
3127
private readonly IChannelHandle _channel;
3228
private bool _disposed;
3329
private readonly ReadPreference _readPreference;
3430
private readonly IServer _server;
3531
private readonly ICoreSessionHandle _session;
3632

37-
// constructors
38-
/// <summary>
39-
/// Initializes a new instance of the <see cref="ChannelReadBinding" /> class.
40-
/// </summary>
41-
/// <param name="server">The server.</param>
42-
/// <param name="channel">The channel.</param>
43-
/// <param name="readPreference">The read preference.</param>
44-
/// <param name="session">The session.</param>
4533
public ChannelReadBinding(IServer server, IChannelHandle channel, ReadPreference readPreference, ICoreSessionHandle session)
4634
{
4735
_server = Ensure.IsNotNull(server, nameof(server));
@@ -50,21 +38,16 @@ public ChannelReadBinding(IServer server, IChannelHandle channel, ReadPreference
5038
_session = Ensure.IsNotNull(session, nameof(session));
5139
}
5240

53-
// properties
54-
/// <inheritdoc/>
5541
public ReadPreference ReadPreference
5642
{
5743
get { return _readPreference; }
5844
}
5945

60-
/// <inheritdoc/>
6146
public ICoreSessionHandle Session
6247
{
6348
get { return _session; }
6449
}
6550

66-
// methods
67-
/// <inheritdoc/>
6851
public void Dispose()
6952
{
7053
if (!_disposed)
@@ -75,27 +58,23 @@ public void Dispose()
7558
}
7659
}
7760

78-
/// <inheritdoc/>
7961
public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
8062
{
8163
ThrowIfDisposed();
8264
return GetReadChannelSourceHelper();
8365
}
8466

85-
/// <inheritdoc/>
8667
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
8768
{
8869
ThrowIfDisposed();
8970
return Task.FromResult<IChannelSourceHandle>(GetReadChannelSourceHelper());
9071
}
9172

92-
/// <inheritdoc />
9373
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
9474
{
9575
return GetReadChannelSource(cancellationToken);
9676
}
9777

98-
/// <inheritdoc />
9978
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
10079
{
10180
return GetReadChannelSourceAsync(cancellationToken);

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

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,46 +22,30 @@
2222

2323
namespace MongoDB.Driver.Core.Bindings
2424
{
25-
/// <summary>
26-
/// Represents a read-write binding that is bound to a channel.
27-
/// </summary>
28-
public sealed class ChannelReadWriteBinding : IReadWriteBinding
25+
internal sealed class ChannelReadWriteBinding : IReadWriteBinding
2926
{
30-
// fields
3127
private readonly IChannelHandle _channel;
3228
private bool _disposed;
3329
private readonly IServer _server;
3430
private readonly ICoreSessionHandle _session;
3531

36-
// constructors
37-
/// <summary>
38-
/// Initializes a new instance of the <see cref="ChannelReadWriteBinding" /> class.
39-
/// </summary>
40-
/// <param name="server">The server.</param>
41-
/// <param name="channel">The channel.</param>
42-
/// <param name="session">The session.</param>
4332
public ChannelReadWriteBinding(IServer server, IChannelHandle channel, ICoreSessionHandle session)
4433
{
4534
_server = Ensure.IsNotNull(server, nameof(server));
4635
_channel = Ensure.IsNotNull(channel, nameof(channel));
4736
_session = Ensure.IsNotNull(session, nameof(session));
4837
}
4938

50-
// properties
51-
/// <inheritdoc/>
5239
public ReadPreference ReadPreference
5340
{
5441
get { return ReadPreference.Primary; }
5542
}
5643

57-
/// <inheritdoc/>
5844
public ICoreSessionHandle Session
5945
{
6046
get { return _session; }
6147
}
6248

63-
// methods
64-
/// <inheritdoc/>
6549
public void Dispose()
6650
{
6751
if (!_disposed)
@@ -72,83 +56,70 @@ public void Dispose()
7256
}
7357
}
7458

75-
/// <inheritdoc/>
7659
public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
7760
{
7861
ThrowIfDisposed();
7962
return GetChannelSourceHelper();
8063
}
8164

82-
/// <inheritdoc/>
8365
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
8466
{
8567
ThrowIfDisposed();
8668
return Task.FromResult(GetChannelSourceHelper());
8769
}
8870

89-
/// <inheritdoc />
9071
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
9172
{
9273
return GetReadChannelSource(cancellationToken);
9374
}
9475

95-
/// <inheritdoc />
9676
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
9777
{
9878
return GetReadChannelSourceAsync(cancellationToken);
9979
}
10080

101-
/// <inheritdoc/>
10281
public IChannelSourceHandle GetWriteChannelSource(CancellationToken cancellationToken)
10382
{
10483
ThrowIfDisposed();
10584
return GetChannelSourceHelper();
10685
}
10786

108-
/// <inheritdoc />
10987
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
11088
{
11189
return GetWriteChannelSource(cancellationToken);
11290
}
11391

114-
/// <inheritdoc/>
11592
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
11693
{
11794
return GetWriteChannelSource(cancellationToken); // ignore mayUseSecondary
11895
}
11996

120-
/// <inheritdoc />
12197
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
12298
{
12399
return GetWriteChannelSource(mayUseSecondary, cancellationToken);
124100
}
125101

126-
/// <inheritdoc/>
127102
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(CancellationToken cancellationToken)
128103
{
129104
ThrowIfDisposed();
130105
return Task.FromResult(GetChannelSourceHelper());
131106
}
132107

133-
/// <inheritdoc />
134108
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
135109
{
136110
return GetWriteChannelSourceAsync(cancellationToken);
137111
}
138112

139-
/// <inheritdoc/>
140113
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
141114
{
142115
return GetWriteChannelSourceAsync(cancellationToken); // ignore mayUseSecondary
143116
}
144117

145-
/// <inheritdoc />
146118
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
147119
{
148120
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationToken);
149121
}
150122

151-
// private methods
152123
private IChannelSourceHandle GetChannelSourceHelper()
153124
{
154125
return new ChannelSourceHandle(new ChannelChannelSource(_server, _channel.Fork(), _session.Fork()));

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

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,122 +22,94 @@
2222

2323
namespace MongoDB.Driver.Core.Bindings
2424
{
25-
/// <summary>
26-
/// Represents a read-write binding to a channel source.
27-
/// </summary>
28-
public sealed class ChannelSourceReadWriteBinding : IReadWriteBinding
25+
internal sealed class ChannelSourceReadWriteBinding : IReadWriteBinding
2926
{
30-
// fields
3127
private readonly IChannelSourceHandle _channelSource;
3228
private bool _disposed;
3329
private readonly ReadPreference _readPreference;
3430
private readonly ICoreSessionHandle _session;
3531

36-
// constructors
37-
/// <summary>
38-
/// Initializes a new instance of the <see cref="ChannelSourceReadWriteBinding" /> class.
39-
/// </summary>
40-
/// <param name="channelSource">The channel source.</param>
41-
/// <param name="readPreference">The read preference.</param>
42-
/// <param name="session">The session.</param>
4332
public ChannelSourceReadWriteBinding(IChannelSourceHandle channelSource, ReadPreference readPreference, ICoreSessionHandle session)
4433
{
4534
_channelSource = Ensure.IsNotNull(channelSource, nameof(channelSource));
4635
_readPreference = Ensure.IsNotNull(readPreference, nameof(readPreference));
4736
_session = Ensure.IsNotNull(session, nameof(session));
4837
}
4938

50-
// properties
51-
/// <inheritdoc/>
5239
public ReadPreference ReadPreference
5340
{
5441
get { return _readPreference; }
5542
}
5643

57-
/// <inheritdoc/>
5844
public ICoreSessionHandle Session
5945
{
6046
get { return _session; }
6147
}
6248

63-
// methods
64-
/// <inheritdoc/>
6549
public IChannelSourceHandle GetReadChannelSource(CancellationToken cancellationToken)
6650
{
6751
ThrowIfDisposed();
6852
return GetChannelSourceHelper();
6953
}
7054

71-
/// <inheritdoc/>
7255
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(CancellationToken cancellationToken)
7356
{
7457
ThrowIfDisposed();
7558
return Task.FromResult(GetChannelSourceHelper());
7659
}
7760

78-
/// <inheritdoc />
7961
public IChannelSourceHandle GetReadChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
8062
{
8163
return GetReadChannelSource(cancellationToken);
8264
}
8365

84-
/// <inheritdoc />
8566
public Task<IChannelSourceHandle> GetReadChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
8667
{
8768
return GetReadChannelSourceAsync(cancellationToken);
8869
}
8970

90-
/// <inheritdoc/>
9171
public IChannelSourceHandle GetWriteChannelSource(CancellationToken cancellationToken)
9272
{
9373
ThrowIfDisposed();
9474
return GetChannelSourceHelper();
9575
}
9676

97-
/// <inheritdoc />
9877
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
9978
{
10079
return GetWriteChannelSource(cancellationToken);
10180
}
10281

103-
/// <inheritdoc/>
10482
public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
10583
{
10684
return GetWriteChannelSource(cancellationToken); // ignore mayUseSecondary
10785
}
10886

109-
/// <inheritdoc />
11087
public IChannelSourceHandle GetWriteChannelSource(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
11188
{
11289
return GetWriteChannelSource(mayUseSecondary, cancellationToken);
11390
}
11491

115-
/// <inheritdoc/>
11692
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(CancellationToken cancellationToken)
11793
{
11894
ThrowIfDisposed();
11995
return Task.FromResult(GetChannelSourceHelper());
12096
}
12197

122-
/// <inheritdoc />
12398
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, CancellationToken cancellationToken)
12499
{
125100
return GetWriteChannelSourceAsync(cancellationToken);
126101
}
127102

128-
/// <inheritdoc/>
129103
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
130104
{
131105
return GetWriteChannelSourceAsync(cancellationToken); // ignore mayUseSecondary
132106
}
133107

134-
/// <inheritdoc />
135108
public Task<IChannelSourceHandle> GetWriteChannelSourceAsync(IReadOnlyCollection<ServerDescription> deprioritizedServers, IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
136109
{
137110
return GetWriteChannelSourceAsync(mayUseSecondary, cancellationToken);
138111
}
139112

140-
/// <inheritdoc/>
141113
public void Dispose()
142114
{
143115
if (!_disposed)

0 commit comments

Comments
 (0)