// methods
 private Task <WriteConcernResult> ExecuteProtocolAsync(IChannelHandle channel, WriteConcern batchWriteConcern, Func <bool> shouldSendGetLastError, CancellationToken cancellationToken)
 {
     return(channel.InsertAsync <TDocument>(
                _collectionNamespace,
                batchWriteConcern,
                _serializer,
                _messageEncoderSettings,
                _documentSource,
                _maxBatchCount,
                _maxMessageSize,
                _continueOnError,
                shouldSendGetLastError,
                cancellationToken));
 }
Пример #2
0
 public static BsonDocument GetWriteConcernForCommandThatWrites(ICoreSession session, WriteConcern writeConcern, SemanticVersion serverVersion)
 {
     return(GetWriteConcernForCommand(session, writeConcern, serverVersion, Feature.CommandsThatWriteAcceptWriteConcern));
 }
Пример #3
0
        public static BsonDocument GetWriteConcernForWriteCommand(ICoreSession session, WriteConcern writeConcern)
        {
            if (!session.IsInTransaction && writeConcern != null && !writeConcern.IsServerDefault)
            {
                return(writeConcern.ToBsonDocument());
            }

            return(null);
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EndTransactionOperation"/> class.
 /// </summary>
 /// <param name="writeConcern">The write concern.</param>
 protected EndTransactionOperation(WriteConcern writeConcern)
     : this(recoveryToken : null, writeConcern)
 {
 }
 public BatchHelper(IReadOnlyList <TWriteRequest> requests, WriteConcern writeConcern, bool isOrdered)
 {
     _requests     = new BatchableSource <TWriteRequest>(requests, 0, requests.Count, canBeSplit: true);
     _writeConcern = writeConcern;
     _isOrdered    = isOrdered;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbortTransactionOperation"/> class.
 /// </summary>
 /// <param name="recoveryToken">The recovery token.</param>
 /// <param name="writeConcern">The write concern.</param>
 public CommitTransactionOperation(BsonDocument recoveryToken, WriteConcern writeConcern)
     : base(recoveryToken, writeConcern)
 {
 }
Пример #7
0
 // protected constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="EndTransactionOperation"/> class.
 /// </summary>
 /// <param name="recoveryToken">The recovery token.</param>
 /// <param name="writeConcern">The write concern.</param>
 protected EndTransactionOperation(BsonDocument recoveryToken, WriteConcern writeConcern)
 {
     _recoveryToken = recoveryToken;
     _writeConcern  = Ensure.IsNotNull(writeConcern, nameof(writeConcern));
 }
Пример #8
0
 // public constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="AbortTransactionOperation"/> class.
 /// </summary>
 /// <param name="writeConcern">The write concern.</param>
 public CommitTransactionOperation(WriteConcern writeConcern)
     : base(writeConcern)
 {
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbortTransactionOperation"/> class.
 /// </summary>
 /// <param name="writeConcern">The write concern.</param>
 public AbortTransactionOperation(WriteConcern writeConcern)
     : base(writeConcern)
 {
 }
Пример #10
0
 // protected constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="EndTransactionOperation"/> class.
 /// </summary>
 /// <param name="writeConcern">The write concern.</param>
 protected EndTransactionOperation(WriteConcern writeConcern)
 {
     _writeConcern = Ensure.IsNotNull(writeConcern, nameof(writeConcern));
 }
 public BatchHelper(IEnumerable <WriteRequest> requests, WriteConcern writeConcern, bool isOrdered)
 {
     _requests     = requests;
     _writeConcern = writeConcern;
     _isOrdered    = isOrdered;
 }
 // constructors
 public BatchHelper(BatchableSource <TDocument> documentSource, WriteConcern writeConcern, bool continueOnError)
 {
     _documentSource  = documentSource;
     _writeConcern    = writeConcern;
     _continueOnError = continueOnError;
 }