Skip to content

Commit fc57655

Browse files
author
John Gibbons
committed
CSHARP-2043: used better name for option: was SuppressEnsureIndexes, now AssumeIndexesExist
1 parent 1c08080 commit fc57655

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

src/MongoDB.Driver.GridFS/GridFSBucket.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ private void EnsureIndexes(IReadWriteBindingHandle binding, CancellationToken ca
814814
{
815815
if (!_ensureIndexesDone)
816816
{
817-
if (!_options.SuppressEnsureIndexes)
817+
if (!_options.AssumeIndexesExist)
818818
{
819819
var isFilesCollectionEmpty = IsFilesCollectionEmpty(binding, cancellationToken);
820820
if (isFilesCollectionEmpty)
@@ -846,7 +846,7 @@ private async Task EnsureIndexesAsync(IReadWriteBindingHandle binding, Cancellat
846846
{
847847
if (!_ensureIndexesDone)
848848
{
849-
if (!_options.SuppressEnsureIndexes)
849+
if (!_options.AssumeIndexesExist)
850850
{
851851
var isFilesCollectionEmpty = await IsFilesCollectionEmptyAsync(binding, cancellationToken).ConfigureAwait(false);
852852
if (isFilesCollectionEmpty)

src/MongoDB.Driver.GridFS/GridFSBucketOptions.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class GridFSBucketOptions
2929
private ReadConcern _readConcern;
3030
private ReadPreference _readPreference;
3131
private WriteConcern _writeConcern;
32-
private bool _suppressEnsureIndexes;
32+
private bool _assumeIndexesExist;
3333

3434
// constructors
3535
/// <summary>
@@ -52,7 +52,7 @@ public GridFSBucketOptions(GridFSBucketOptions other)
5252
_readConcern = other.ReadConcern;
5353
_readPreference = other.ReadPreference;
5454
_writeConcern = other.WriteConcern;
55-
_suppressEnsureIndexes = other.SuppressEnsureIndexes;
55+
_assumeIndexesExist = other.AssumeIndexesExist;
5656
}
5757

5858
/// <summary>
@@ -67,7 +67,7 @@ public GridFSBucketOptions(ImmutableGridFSBucketOptions other)
6767
_readConcern = other.ReadConcern;
6868
_readPreference = other.ReadPreference;
6969
_writeConcern = other.WriteConcern;
70-
_suppressEnsureIndexes = other.SuppressEnsureIndexes;
70+
_assumeIndexesExist = other.AssumeIndexesExist;
7171
}
7272

7373
// properties
@@ -140,15 +140,15 @@ public WriteConcern WriteConcern
140140
}
141141

142142
/// <summary>
143-
/// Gets or sets the suppress ensure indexes setting
143+
/// Gets or sets the assume indexes exist setting
144144
/// </summary>
145145
/// <value>
146-
/// The suppress ensure indexes setting
146+
/// The assume indexes exist setting
147147
/// </value>
148-
public bool SuppressEnsureIndexes
148+
public bool AssumeIndexesExist
149149
{
150-
get { return _suppressEnsureIndexes; }
151-
set { _suppressEnsureIndexes = value; }
150+
get { return _assumeIndexesExist; }
151+
set { _assumeIndexesExist = value; }
152152
}
153153
}
154154

@@ -180,7 +180,7 @@ public static ImmutableGridFSBucketOptions Defaults
180180
private readonly ReadConcern _readConcern;
181181
private readonly ReadPreference _readPreference;
182182
private readonly WriteConcern _writeConcern;
183-
private readonly bool _suppressEnsureIndexes;
183+
private readonly bool _assumeIndexesExist;
184184

185185
// constructors
186186
/// <summary>
@@ -190,7 +190,7 @@ public ImmutableGridFSBucketOptions()
190190
{
191191
_bucketName = "fs";
192192
_chunkSizeBytes = 255 * 1024;
193-
_suppressEnsureIndexes = false;
193+
_assumeIndexesExist = false;
194194
}
195195

196196
/// <summary>
@@ -205,7 +205,7 @@ public ImmutableGridFSBucketOptions(GridFSBucketOptions other)
205205
_readConcern = other.ReadConcern;
206206
_readPreference = other.ReadPreference;
207207
_writeConcern = other.WriteConcern;
208-
_suppressEnsureIndexes = other.SuppressEnsureIndexes;
208+
_assumeIndexesExist = other.AssumeIndexesExist;
209209
}
210210

211211
// properties
@@ -276,14 +276,14 @@ public WriteConcern WriteConcern
276276
}
277277

278278
/// <summary>
279-
/// Gets the suppress ensure indexes setting
279+
/// Gets the assume ensure indexes setting
280280
/// </summary>
281281
/// <value>
282-
/// The suppress ensure indexes setting
282+
/// The assume ensure indexes setting
283283
/// </value>
284-
public bool SuppressEnsureIndexes
284+
public bool AssumeIndexesExist
285285
{
286-
get { return _suppressEnsureIndexes; }
286+
get { return _assumeIndexesExist; }
287287
}
288288
}
289289
}

tests/MongoDB.Driver.GridFS.Tests/GridFSBucketOptionsTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void constructor_with_immutable_other_should_initialize_instance()
117117
[Fact]
118118
public void constructor_with_mutable_other_should_initialize_instance()
119119
{
120-
var other = new GridFSBucketOptions { BucketName = "bucket", ChunkSizeBytes = 123, ReadConcern = ReadConcern.Majority, ReadPreference = ReadPreference.Secondary, WriteConcern = WriteConcern.WMajority, SuppressEnsureIndexes = true };
120+
var other = new GridFSBucketOptions { BucketName = "bucket", ChunkSizeBytes = 123, ReadConcern = ReadConcern.Majority, ReadPreference = ReadPreference.Secondary, WriteConcern = WriteConcern.WMajority, AssumeIndexesExist = true };
121121

122122
var result = new GridFSBucketOptions(other);
123123

@@ -126,7 +126,7 @@ public void constructor_with_mutable_other_should_initialize_instance()
126126
result.ReadConcern.Should().Be(other.ReadConcern);
127127
result.ReadPreference.Should().Be(other.ReadPreference);
128128
result.WriteConcern.Should().Be(other.WriteConcern);
129-
result.SuppressEnsureIndexes.Should().Be(other.SuppressEnsureIndexes);
129+
result.AssumeIndexesExist.Should().Be(other.AssumeIndexesExist);
130130
}
131131

132132
[Fact]
@@ -138,7 +138,7 @@ public void constructor_with_no_arguments_should_initialize_instance_with_defaul
138138
result.ChunkSizeBytes.Should().Be(255 * 1024);
139139
result.ReadPreference.Should().BeNull();
140140
result.WriteConcern.Should().BeNull();
141-
result.SuppressEnsureIndexes.Should().BeFalse();
141+
result.AssumeIndexesExist.Should().BeFalse();
142142
}
143143

144144
[Fact]
@@ -202,23 +202,23 @@ public void WriteConcern_set_should_have_expected_result()
202202
}
203203

204204
[Fact]
205-
public void SuppressEnsureIndexes_get_should_return_expected_result()
205+
public void AssumeIndexesExist_get_should_return_expected_result()
206206
{
207-
var subject = new GridFSBucketOptions { SuppressEnsureIndexes = true };
207+
var subject = new GridFSBucketOptions { AssumeIndexesExist = true };
208208

209-
var result = subject.SuppressEnsureIndexes;
209+
var result = subject.AssumeIndexesExist;
210210

211211
result.Should().BeTrue();
212212
}
213213

214214
[Fact]
215-
public void SuppressEnsureIndexes_set_should_have_expected_result()
215+
public void AssumeIndexesExist_set_should_have_expected_result()
216216
{
217217
var subject = new GridFSBucketOptions();
218218

219-
subject.SuppressEnsureIndexes = true;
219+
subject.AssumeIndexesExist = true;
220220

221-
subject.SuppressEnsureIndexes.Should().BeTrue();
221+
subject.AssumeIndexesExist.Should().BeTrue();
222222
}
223223
}
224224

@@ -247,7 +247,7 @@ public void ChunkSizeBytes_get_should_return_expected_result()
247247
[Fact]
248248
public void constructor_with_arguments_should_initialize_instance()
249249
{
250-
var mutable = new GridFSBucketOptions { BucketName = "bucket", ChunkSizeBytes = 123, ReadConcern = ReadConcern.Majority, ReadPreference = ReadPreference.Secondary, WriteConcern = WriteConcern.WMajority, SuppressEnsureIndexes = true };
250+
var mutable = new GridFSBucketOptions { BucketName = "bucket", ChunkSizeBytes = 123, ReadConcern = ReadConcern.Majority, ReadPreference = ReadPreference.Secondary, WriteConcern = WriteConcern.WMajority, AssumeIndexesExist = true };
251251

252252
var result = new ImmutableGridFSBucketOptions(mutable);
253253

@@ -256,7 +256,7 @@ public void constructor_with_arguments_should_initialize_instance()
256256
result.ReadConcern.Should().Be(ReadConcern.Majority);
257257
result.ReadPreference.Should().Be(ReadPreference.Secondary);
258258
result.WriteConcern.Should().Be(WriteConcern.WMajority);
259-
result.SuppressEnsureIndexes.Should().BeTrue();
259+
result.AssumeIndexesExist.Should().BeTrue();
260260
}
261261

262262
[Fact]
@@ -269,7 +269,7 @@ public void constructor_with_no_arguments_should_initialize_instance_with_defaul
269269
result.ReadConcern.Should().BeNull();
270270
result.ReadPreference.Should().BeNull();
271271
result.WriteConcern.Should().BeNull();
272-
result.SuppressEnsureIndexes.Should().BeFalse();
272+
result.AssumeIndexesExist.Should().BeFalse();
273273
}
274274

275275
[Fact]
@@ -291,7 +291,7 @@ public void Defaults_get_should_return_expected_result()
291291
result.ReadConcern.Should().BeNull();
292292
result.ReadPreference.Should().BeNull();
293293
result.WriteConcern.Should().BeNull();
294-
result.SuppressEnsureIndexes.Should().BeFalse();
294+
result.AssumeIndexesExist.Should().BeFalse();
295295
}
296296

297297
[Fact]
@@ -325,11 +325,11 @@ public void WriteConcern_get_should_return_expected_result()
325325
}
326326

327327
[Fact]
328-
public void SuppressEnsureIndexes_get_should_return_expected_result()
328+
public void AssumeIndexesExist_get_should_return_expected_result()
329329
{
330-
var subject = new ImmutableGridFSBucketOptions(new GridFSBucketOptions { SuppressEnsureIndexes = true });
330+
var subject = new ImmutableGridFSBucketOptions(new GridFSBucketOptions { AssumeIndexesExist = true });
331331

332-
var result = subject.SuppressEnsureIndexes;
332+
var result = subject.AssumeIndexesExist;
333333

334334
result.Should().BeTrue();
335335
}

0 commit comments

Comments
 (0)