Skip to content

Commit 7ccdd89

Browse files
committed
Remove sync prefixes
1 parent 45a6f44 commit 7ccdd89

Some content is hidden

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

53 files changed

+525
-530
lines changed

Examples/Docs/Sources/DocsExamples/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import MongoSwift
66
/// Examples used for the MongoDB documentation on Causal Consistency.
77
/// - SeeAlso: https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/#examples
88
private func causalConsistency() throws {
9-
let client1 = try SyncMongoClient()
9+
let client1 = try MongoClient()
1010

1111
// Start Causal Consistency Example 1
1212
let s1 = try client1.startSession(options: ClientSessionOptions(causalConsistency: true))
@@ -24,7 +24,7 @@ private func causalConsistency() throws {
2424
try items.insertOne(["sku": "nuts-111", "name": "Pecans", "start": .datetime(currentDate)], session: s1)
2525
// End Causal Consistency Example 1
2626

27-
let client2 = try SyncMongoClient()
27+
let client2 = try MongoClient()
2828

2929
// Start Causal Consistency Example 2
3030
try client2.withSession(options: ClientSessionOptions(causalConsistency: true)) { s2 in
@@ -44,7 +44,7 @@ private func causalConsistency() throws {
4444
/// Examples used for the MongoDB documentation on Change Streams.
4545
/// - SeeAlso: https://docs.mongodb.com/manual/changeStreams/
4646
private func changeStreams() throws {
47-
let client = try SyncMongoClient()
47+
let client = try MongoClient()
4848
let db = client.db("example")
4949

5050
// The following examples assume that you have connected to a MongoDB replica set and have

Sources/AtlasConnectivity/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ for config in configs {
1212
}
1313

1414
do {
15-
let client = try SyncMongoClient(uri)
15+
let client = try MongoClient(uri)
1616
// run isMaster
1717
let db = client.db("test")
1818
_ = try db.runCommand(["isMaster": 1])

Sources/MongoSwift/APM.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ private func postNotification<T: MongoEvent>(
481481
guard let context = contextFunc(event) else {
482482
fatalError("Missing context for \(type)")
483483
}
484-
let client = Unmanaged<SyncMongoClient>.fromOpaque(context).takeUnretainedValue()
484+
let client = Unmanaged<MongoClient>.fromOpaque(context).takeUnretainedValue()
485485
let notification = Notification(name: type.eventName, userInfo: ["event": eventStruct])
486486
client.notificationCenter.post(notification)
487487
}
@@ -518,7 +518,7 @@ extension Notification.Name {
518518
/// An extension of `ConnectionPool` to add monitoring capability for commands and server discovery and monitoring.
519519
extension ConnectionPool {
520520
/// Internal function to install monitoring callbacks for this pool.
521-
internal func initializeMonitoring(commandMonitoring: Bool, serverMonitoring: Bool, client: SyncMongoClient) {
521+
internal func initializeMonitoring(commandMonitoring: Bool, serverMonitoring: Bool, client: MongoClient) {
522522
guard let callbacks = mongoc_apm_callbacks_new() else {
523523
fatalError("failed to initialize new mongoc_apm_callbacks_t")
524524
}
@@ -542,8 +542,8 @@ extension ConnectionPool {
542542
mongoc_apm_set_server_heartbeat_failed_cb(callbacks, serverHeartbeatFailed)
543543
}
544544

545-
// we can pass the SyncMongoClient as unretained because the callbacks are stored on clientHandle, so if the
546-
// callback is being executed, this pool and therefore its parent `SyncMongoClient` must still be valid.
545+
// we can pass the MongoClient as unretained because the callbacks are stored on clientHandle, so if the
546+
// callback is being executed, this pool and therefore its parent `MongoClient` must still be valid.
547547
switch self.mode {
548548
case let .single(clientHandle):
549549
mongoc_client_set_apm_callbacks(clientHandle, callbacks, Unmanaged.passUnretained(client).toOpaque())

Sources/MongoSwift/BSON/CodingStrategies.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ public struct BSONCoderOptions: CodingStrategyProvider {
3737

3838
/**
3939
* Enum representing the various encoding/decoding strategy pairs for `Date`s.
40-
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection`, or a `SyncMongoClient`, `SyncMongoDatabase`, or
41-
* `SyncMongoCollection`, so that the strategies will be applied when converting `Date`s between their BSON
42-
* representations and their representations in (non `Document`) `Codable` types.
40+
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection` so that the strategies will be applied when
41+
* converting `Date`s between their BSON representations and their representations in (non `Document`) `Codable` types.
4342
*
4443
* As per the BSON specification, the default strategy is to encode `Date`s as BSON datetime objects.
4544
*
@@ -123,9 +122,8 @@ public enum DateCodingStrategy: RawRepresentable {
123122

124123
/**
125124
* Enum representing the various encoding/decoding strategy pairs for `Date`s.
126-
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection`, or a `SyncMongoClient`, `SyncMongoDatabase`, or
127-
* `SyncMongoCollection`, so that the strategies will be applied when converting `UUID`s between their BSON
128-
* representations and their representations in (non `Document`) `Codable` types.
125+
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection` so that the strategies will be applied when
126+
* converting `UUID`s between their BSON representations and their representations in (non `Document`) `Codable` types.
129127
*
130128
* As per the BSON specification, the default strategy is to encode `UUID`s as BSON binary types with the UUID
131129
* subtype.
@@ -164,9 +162,8 @@ public enum UUIDCodingStrategy: RawRepresentable {
164162

165163
/**
166164
* Enum representing the various encoding/decoding strategy pairs for `Date`s.
167-
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection`, or a `SyncMongoClient`, `SyncMongoDatabase`, or
168-
* `SyncMongoCollection`, so that the strategies will be applied when converting `Data`s between their BSON
169-
* representations and their representations in (non `Document`) `Codable` types.
165+
* Set these on a `MongoClient`, `MongoDatabase`, or `MongoCollection` so that the strategies will be applied when
166+
* converting `Data`s between their BSON representations and their representations in (non `Document`) `Codable` types.
170167
*
171168
* As per the BSON specification, the default strategy is to encode `Data`s as BSON binary types with the generic
172169
* binary subtype.

Sources/MongoSwift/ChangeStream.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public struct ResumeToken: Codable, Equatable {
2424
}
2525
}
2626

27-
/// A synchronous MongoDB change stream.
27+
/// A MongoDB change stream.
2828
/// - SeeAlso: https://docs.mongodb.com/manual/changeStreams/
29-
public class SyncChangeStream<T: Codable>: Sequence, IteratorProtocol {
29+
public class ChangeStream<T: Codable>: Sequence, IteratorProtocol {
3030
/// Enum for tracking the state of a change stream.
3131
internal enum State {
3232
/// Indicates that the change stream is still open. Stores a pointer to the `mongoc_change_stream_t`, along
@@ -35,8 +35,8 @@ public class SyncChangeStream<T: Codable>: Sequence, IteratorProtocol {
3535
case open(
3636
changeStream: OpaquePointer,
3737
connection: Connection,
38-
client: SyncMongoClient,
39-
session: SyncClientSession?
38+
client: MongoClient,
39+
session: ClientSession?
4040
)
4141
case closed
4242
}
@@ -139,16 +139,16 @@ public class SyncChangeStream<T: Codable>: Sequence, IteratorProtocol {
139139
}
140140

141141
/**
142-
* Initializes a `SyncChangeStream`.
142+
* Initializes a `ChangeStream`.
143143
* - Throws:
144144
* - `ServerError.commandError` if an error occurred on the server when creating the `mongoc_change_stream_t`.
145145
* - `UserError.invalidArgumentError` if the `mongoc_change_stream_t` was created with invalid options.
146146
*/
147147
internal init(
148148
stealing changeStream: OpaquePointer,
149149
connection: Connection,
150-
client: SyncMongoClient,
151-
session: SyncClientSession?,
150+
client: MongoClient,
151+
session: ClientSession?,
152152
decoder: BSONDecoder,
153153
options: ChangeStreamOptions?
154154
) throws {

Sources/MongoSwift/ChangeStreamDocument.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public enum OperationType: String, Codable {
3737
case rename
3838
}
3939

40-
/// The response document type from a `ChangeStream` or a `SyncChangeStream`.
40+
/// The response document type from a `ChangeStream`.
4141
public struct ChangeStreamEvent<T: Codable>: Codable {
4242
/// Describes the type of operation for this change.
4343
public let operationType: OperationType

Sources/MongoSwift/ChangeStreamOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public enum FullDocument: RawRepresentable, Codable {
2626
}
2727
}
2828

29-
/// Options to use when creating a `ChangeStream` or `SyncChangeStream`.
29+
/// Options to use when creating a `ChangeStream`.
3030
public struct ChangeStreamOptions: Codable {
3131
/// The number of documents to return per batch. If omitted, the server will use its default batch size.
3232
/// - SeeAlso: https://docs.mongodb.com/manual/reference/command/aggregate

Sources/MongoSwift/ClientSession.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import mongoc
33

4-
/// Options to use when creating a `ClientSession` or `SyncClientSession`.
4+
/// Options to use when creating a `ClientSession`.
55
public struct ClientSessionOptions {
66
/// Whether to enable causal consistency for this session. By default, causal consistency is enabled.
77
///
@@ -33,7 +33,7 @@ private func withSessionOpts<T>(
3333
* A MongoDB client session.
3434
* This class represents a logical session used for ordering sequential operations.
3535
*
36-
* To create a client session, use `startSession` or `withSession` on a `MongoClient` or a `SyncMongoClient`.
36+
* To create a client session, use `startSession` or `withSession` on a `MongoClient`.
3737
*
3838
* If `causalConsistency` is not set to `false` when starting a session, read and write operations that use the session
3939
* will be provided causal consistency guarantees depending on the read and write concerns used. Using "majority"
@@ -57,7 +57,7 @@ private func withSessionOpts<T>(
5757
* - https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/#sessions
5858
* - https://docs.mongodb.com/manual/core/causal-consistency-read-write-concerns/
5959
*/
60-
public final class SyncClientSession {
60+
public final class ClientSession {
6161
/// Error thrown when an inactive session is used.
6262
internal static let SessionInactiveError = UserError.logicError(message: "Tried to use an inactive session")
6363
/// Error thrown when a user attempts to use a session with a client it was not created from.
@@ -86,7 +86,7 @@ public final class SyncClientSession {
8686
}
8787

8888
/// The client used to start this session.
89-
public let client: SyncMongoClient
89+
public let client: MongoClient
9090

9191
/// The session ID of this session.
9292
public let id: Document
@@ -125,7 +125,7 @@ public final class SyncClientSession {
125125
public let options: ClientSessionOptions?
126126

127127
/// Initializes a new client session.
128-
internal init(client: SyncMongoClient, options: ClientSessionOptions? = nil) throws {
128+
internal init(client: MongoClient, options: ClientSessionOptions? = nil) throws {
129129
self.options = options
130130
self.client = client
131131

@@ -147,12 +147,12 @@ public final class SyncClientSession {
147147

148148
/// Retrieves this session's underlying connection. Throws an error if the provided client was not the client used
149149
/// to create this session, or if this session has been ended.
150-
internal func getConnection(forUseWith client: SyncMongoClient) throws -> Connection {
150+
internal func getConnection(forUseWith client: MongoClient) throws -> Connection {
151151
guard case let .active(_, connection) = self.state else {
152-
throw SyncClientSession.SessionInactiveError
152+
throw ClientSession.SessionInactiveError
153153
}
154154
guard self.client == client else {
155-
throw SyncClientSession.ClientMismatchError
155+
throw ClientSession.ClientMismatchError
156156
}
157157
return connection
158158
}
@@ -205,7 +205,7 @@ public final class SyncClientSession {
205205
/// - `UserError.logicError` if this session is inactive
206206
internal func append(to doc: inout Document) throws {
207207
guard case let .active(session, _) = self.state else {
208-
throw SyncClientSession.SessionInactiveError
208+
throw ClientSession.SessionInactiveError
209209
}
210210

211211
var error = bson_error_t()

0 commit comments

Comments
 (0)