Sha256: bda100e7988fc465fdd7263c538d36c1ca4cbf46baef6cda72e35f871a19335c
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
# Copyright (C) 2017 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Mongo module Operation # A command that uses OP_MSG, with the document as payload type 0. # # @since 2.5.0 module UsesCommandOpMsg private READ_PREFERENCE = '$readPreference'.freeze def add_cluster_time!(selector, server) if cluster_time = server.mongos? && server.cluster_time selector[CLUSTER_TIME] = cluster_time end end def unacknowledged_write? write_concern && write_concern.get_last_error.nil? end def command_op_msg(server, selector, options) add_cluster_time!(selector, server) selector[Protocol::Msg::DATABASE_IDENTIFIER] = db_name selector[READ_PREFERENCE] = read.to_doc if read session.add_id!(selector) if session flags = unacknowledged_write? ? [:more_to_come] : [:none] Protocol::Msg.new(flags, options, selector) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.5.0.beta | lib/mongo/operation/uses_command_op_msg.rb |