Browse files

Merge remote branch 'b/master'

  • Loading branch information...
2 parents 56f7c6e + a330c68 commit f115ad97ab6e9a5f88d527354dbfbb4aa5b21f31 @ryanking ryanking committed Aug 23, 2010
Showing with 10 additions and 4 deletions.
  1. +6 −0 lib/cassandra/0.7/cassandra.rb
  2. +4 −4 lib/cassandra/cassandra.rb
View
6 lib/cassandra/0.7/cassandra.rb
@@ -3,6 +3,12 @@ def self.DEFAULT_TRANSPORT_WRAPPER
Thrift::FramedTransport
end
+ def login!(username, password)
+ @auth_request = CassandraThrift::AuthenticationRequest.new
+ @auth_request.credentials = {'username' => username, 'password' => password}
+ client.login(@auth_request)
+ end
+
def keyspace=(ks)
client.set_keyspace(ks) if check_keyspace(ks)
@schema = nil; @keyspace = ks
View
8 lib/cassandra/cassandra.rb
@@ -231,16 +231,16 @@ def count_range(column_family, options = {})
get_range(column_family, options).select{|r| r.columns.length > 0}.compact.length
end
- # Open a batch operation and yield. Inserts and deletes will be queued until
- # the block closes, and then sent atomically to the server. Supports the
- # <tt>:consistency</tt> option, which overrides the consistency set in
+ # Open a batch operation and yield self. Inserts and deletes will be queued
+ # until the block closes, and then sent atomically to the server. Supports
+ # the <tt>:consistency</tt> option, which overrides the consistency set in
# the individual commands.
def batch(options = {})
_, _, _, options =
extract_and_validate_params(schema.keys.first, "", [options], WRITE_DEFAULTS)
@batch = []
- yield
+ yield(self)
compact_mutations!
@batch.each do |mutation|

0 comments on commit f115ad9

Please sign in to comment.