Commit Graph

100 Commits

Author SHA1 Message Date
Kyle Banker 68af3dbe8f Allow the setting of safe mode globally on the Connection,
DB, and Collection levels. The safe mode setting will
automatically be inherited down the hierarchy Connection ->
DB -> Collection -> (insert, update, remove). This default
can be overridden at any time. Connection#safe, DB#safe, and
Collection#safe will yield the current default value.
2010-11-03 17:36:08 -04:00
Kyle Banker f7d151c8dc minor: doc fixes 2010-11-03 15:32:19 -04:00
Kyle Banker d6f8f9d41a Allow specification of replica set name on connect.
Raise ReplicaSetConnectionError if expected name doesn't match set.
2010-11-03 15:12:15 -04:00
Kyle Banker 2939932526 close connection when safe mode insert results in 'not master' 2010-10-29 23:18:49 -04:00
Kyle Banker 424f08af5e close connection on exception on safe insert 2010-10-29 17:52:15 -04:00
Kyle Banker e416e05fc7 RUBY-190 bug fix for unavailable nodes on Connection#multi 2010-10-21 14:33:48 -04:00
Kyle Banker a905c3f1f2 RUBY-191 fix to pass options to new db with Connection#db 2010-10-21 13:27:57 -04:00
Kyle Banker 80044b9a58 RUBY-187 All tests can now use custom host and port;
Minor test fixes.
2010-10-13 17:09:23 -04:00
Kyle Banker f7a97a0db0 Removed deprecated Connection methods 2010-10-04 12:16:11 -04:00
Kyle Banker 7ad280c2cb RUBY-184 Connection#locked? 2010-10-04 11:38:20 -04:00
Kyle Banker 4141331f79 RUBY-184 fsync lock helpers 2010-09-28 12:15:45 -04:00
Hongli Lai (Phusion) b474b29d35 Optimize Mongo::Connection#receive_message_on_socket and #receive_and_discard_message_on_socket: avoid creating initial input buffer up front so that IO#read only needs to allocate the buffer once. 2010-09-14 10:37:08 -04:00
Hongli Lai (Phusion) 6316c939d5 Optimize Mongo::Connection#send_message_on_socket: don't slice the input when not necessary. 2010-09-14 10:36:54 -04:00
Hongli Lai (Phusion) 87e6d578c1 Optimize Mongo::Connection#add_message_headers by packing data directly instead of using ByteBuffer. 2010-09-14 10:36:40 -04:00
Hongli Lai (Phusion) 0585aa1aae Fix MongoDB::Collection #insert_documents, #update and #remove and MongoDB::Connection #receive_header and #last_error_message: usage strings as much as possible instead of byte arrays, otherwise performance really suffers. 2010-09-13 10:51:53 -04:00
Hongli Lai (Phusion) c6206eddf4 Optimize MongoDB::Connection#receive_response_header by using raw string operations and unpack() instead of the slower ByteBuffer. 2010-09-13 10:50:39 -04:00
Hongli Lai (Phusion) e1bf168767 Optimize MongoDB::Connection#receive.
It doesn't do anything with the header. So instead of parsing the header,
just read the header data and discard it.
2010-09-13 10:50:25 -04:00
Hongli Lai (Phusion) 2291a59fcc Optimize Mongo::Connection#read_documents by using raw string operations and unpack() instead of the slower ByteBuffer. 2010-09-13 10:50:16 -04:00
Hongli Lai (Phusion) 117ce2389c Optimize receive_message_on_socket for the optimistic average case where 1 socket.read() operation receives all requested data. Also fix some Ruby 1.9 encoding issues in that function while we're at it. 2010-09-13 10:48:32 -04:00
Mislav Marohnić 56f37e49b6 replace usage of `returning` with `each_with_object`
`each_with_object` is a Ruby 1.9 method, here re-implemented in core_ext.rb
in case it's missing (for older Ruby versions). Using `returning` is bad in
combination with Ruby on Rails because each usage of the method will emit
a Rails deprecation warning. This might be considered an Active Support bug,
but it's better to avoid using `returning` altogether and use `tap` from
Ruby 1.8.7, also re-implemented here in case it's missing.

Since existing usages or `returning` were better suited for `each_with_object`
than `tap`, they were rewritten using the former instead.
2010-09-13 01:10:38 +08:00
Kyle Banker 300b442a94 Create logging message only when a logger is passed to the Connection.
Results in a pretty significant performance improvement.

Many thanks to Matt Taylor for noticing the unusual glut of calls
to ObjectId#to_s. See here: http://unhalting.com/?p=18
2010-09-08 14:27:27 -04:00
Steve Sloan dfcf8d9d60 Moved thread and socket classes into Connection for easy overriding.
This is necessary for use under em-synchrony, which uses Fibers instead of Threads and EventMachine instead of blocking sockets.
2010-08-24 14:35:21 -04:00
Kyle Banker 5cbec4e5b6 RUBY-161 accessors for hosts in a replica set by node type 2010-08-24 11:20:54 -04:00
Kyle Banker db8ddd059b minor: silence some warning due to deprecaton 2010-08-04 16:47:13 -04:00
Kyle Banker 02e5b77219 minor: cleanup (chriseppstein) 2010-07-28 06:27:42 -04:00
Kyle Banker 66e9508f61 Connection#send_message should return bytes sent 2010-07-27 22:19:25 -04:00
Kyle Banker db27756597 minor: docs 2010-07-26 18:05:23 -04:00
Kyle Banker e3c1b1eafe minor: logger bug fix (bernerdschaefer) 2010-07-21 15:27:29 -04:00
Kyle Banker 476d856abb minor: reorganization. warn if using replica sets RUBY-148 2010-07-19 12:23:12 -04:00
Kyle Banker 0afa5aa412 Initial replica set support 2010-07-19 12:07:46 -04:00
Kyle Banker a14d02e98d Use one mutex per thread on pooled connections (cremes) 2010-07-12 14:14:35 -04:00
Kyle Banker 1b78c3a73c minor: reverted breaking change -- more debugging needed 2010-07-12 13:10:43 -04:00
Kyle Banker 265f074f10 RUBY-147 check for CursorNotFound response flag 2010-07-12 12:11:01 -04:00
Lincoln Stoll 6e3cc639f6 Allow hypens and underscores in URL credentials. 2010-06-24 12:51:16 -05:00
Kyle Banker 82ffae676b RUBY-142 (Frédéric De Jaeger) fix for broken socket send 2010-06-24 12:46:06 -05:00
Kyle Banker 51140f8ea1 minor: support dash in host name on parse_uri 2010-06-14 22:06:55 -04:00
Kyle Banker c28b126267 RUBY-132 ensure socket closes on connect to master 2010-06-14 18:56:44 -04:00
Kyle Banker 67a56b64eb fixed connection uri bug (Sunny Hirai) 2010-06-12 10:11:29 -04:00
Kyle Banker a7e2991c31 fix for boolean command response in core server 1.5.2 2010-05-31 22:52:03 -04:00
Kyle Banker 924a275ea3 check command response by default; better DB#command api 2010-05-18 16:17:17 -04:00
Kyle Banker 97ee66be02 minor: source file encoding with magic comment 2010-05-07 15:33:27 -04:00
sleverbor ed76126a12 namespaced the OrderedHash class 2010-05-06 18:25:18 -07:00
Kyle Banker 56661c4c66 minor: docs 2010-05-04 16:06:06 -04:00
Kyle Banker 065d97ca1c Replication acknowledgment RUBY-126 2010-05-04 16:00:05 -04:00
Kyle Banker 56ecc470f5 minor: docs 2010-04-19 12:16:45 -04:00
Kyle Banker 910a82de7e must use Connection.paired for paired connections 2010-04-07 17:10:28 -04:00
Kyle Banker c4d5cb641b renamed mongo_bson to bson 2010-04-05 10:39:55 -04:00
Kyle Banker f2bc05f51c merge new bson commits 2010-03-19 15:23:24 -04:00
Charles Remes a9b3c8e7a5 Try again: Split the BSON logic out to a separate gem
- changed the BSON constant to BSON_CODER and scoped it inside
      of a module

    - changed the directory layout for all of the BSON related files

    - updated the C extension to find the BSON files at their new
      directory locations

    - updated the C extension to use better/safer macros for accessing
      the C API; extension now compiles cleanly under rubinius/rbx

    - changed directory layout for BSON related tests

    - modified the Rakefile to understand the new layout
2010-03-17 14:55:19 -05:00
Kyle Banker 9dd1a5c2e3 added authentication support for copy_database 2010-03-16 13:56:30 -04:00