hyper_record 0.2.8 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ 0.9.3.0 (2010/05/30)
2
+ - updated HyperRecord version numbers to match Hypertable release number
3
+ - now compatible with Hypertable version 0.9.3.0
4
+ - no longer compatible with earlier Hypertable versions due to a Thrift
5
+ API change
6
+ - added support for asynchronous writes through new put_cells ThriftBroker API
7
+ - add documentation for running tests
8
+
1
9
  0.2.8 (2010/03/01)
2
10
  - support friendly migration-syntax declared using blocks
3
11
  - new assemble_row_key_from_attributes that generates row keys in the same
data/HOW_TO_RUN_TESTS ADDED
@@ -0,0 +1,44 @@
1
+ The HyperRecord test suite is spread out across a number of different files
2
+ in the test/ and spec/ directories.
3
+
4
+ $ ls -l test/
5
+ total 28
6
+ -rw-r--r-- 1 root root 188 May 20 15:36 test_helper.rb
7
+ -rw-r--r-- 1 root root 22281 May 30 13:56 thrift_client_test.rb
8
+
9
+ $ ls -l spec/
10
+ total 12
11
+ drwxr-xr-x 3 root root 4096 May 20 15:36 fixtures
12
+ drwxr-xr-x 3 root root 4096 May 30 14:08 lib
13
+ -rw-r--r-- 1 root root 4067 May 20 15:36 spec_helper.rb
14
+
15
+ The test/ directory contains unit tests (using Ruby's standard Test::Unit
16
+ library) that exercise the Thrift client libraries only. These tests do
17
+ not cover any functionality specific to HyperRecord.
18
+
19
+ To run the Thrift client unit tests:
20
+ $ rake
21
+ <snip test output>
22
+
23
+ Failures in the test/ suite may be caused by:
24
+
25
+ 1. A mismatch between the version of Thrift installed on your local machine
26
+ and the version of Thrift supported in this release on HyperRecord.
27
+ 2. Problems communicating with a ThriftBroker process running on the default
28
+ port (38080) on localhost. Note: you must be running Hypertable for
29
+ these tests to pass and, specifically, a ThriftBroker process must be
30
+ running on localhost.
31
+
32
+ The spec/ directory contains rspec tests that cover HyperRecord functionality.
33
+ Since HyperRecord extends the base ActiveRecord implementation, these tests
34
+ can only be run if the HyperRecord gem directory has been unpacked into a
35
+ local Rails tree. This is typically done by:
36
+
37
+ $ gem install hyper_record
38
+ $ cd vendor/gems
39
+ $ gem unpack hyper_recrd
40
+ $ gem uninstall hyper_record
41
+
42
+ To run the HyperRecord rspec tests:
43
+ $ rake spec
44
+ <snip test output>
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 tylerkovacs
1
+ Copyright (c) 2010 tylerkovacs
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -19,15 +19,11 @@ See:
19
19
  INSTALLATION
20
20
  ============
21
21
 
22
- 1. Add github as a gem source (if you haven't already)
22
+ 1. Install HyperRecord gem (http://rubygems.org/gems/hyper_record)
23
23
 
24
- gem sources -a http://gems.github.com
24
+ gem install hyper_record
25
25
 
26
- 2. Install HyperRecord gem
27
-
28
- gem install tylerkovacs-hyper_record
29
-
30
- 3. Configure Hypertable Adapter by adding an entry to config/database.yml
26
+ 2. Configure Hypertable Adapter by adding an entry to config/database.yml
31
27
  that points to an instance of the Hypertable Thrift Broker (uses port
32
28
  38080 by default).
33
29
 
@@ -38,7 +34,7 @@ INSTALLATION
38
34
 
39
35
  NOTE: HyperRecord requires Thrift SVN revision 765279 or later.
40
36
 
41
- 4. Add the following to the bottom of config/environment.rb:
37
+ 3. Add the following to the bottom of config/environment.rb:
42
38
 
43
39
  require 'hyper_record'
44
40
 
@@ -46,4 +42,4 @@ INSTALLATION
46
42
  COPYRIGHT
47
43
  =========
48
44
 
49
- Copyright (c) 2008 tylerkovacs. See LICENSE for details.
45
+ Copyright (c) 2010 tylerkovacs. See LICENSE for details.
data/Rakefile CHANGED
@@ -14,8 +14,6 @@ begin
14
14
  s.description = "See README"
15
15
  s.authors = ["tylerkovacs"]
16
16
  end
17
-
18
- Jeweler::GemcutterTasks.new
19
17
  rescue LoadError
20
18
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
21
19
  end
@@ -40,4 +38,13 @@ Rcov::RcovTask.new do |t|
40
38
  t.verbose = true
41
39
  end
42
40
 
43
- task :default => :rcov
41
+ task :noop do
42
+ end
43
+
44
+ Rake::TestTask.new(:spec => :noop) do |t|
45
+ t.libs << 'spec'
46
+ t.test_files = FileList['spec/**/*_spec.rb']
47
+ t.verbose = true
48
+ end
49
+
50
+ task :default => :test
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
- :patch: 8
3
+ :minor: 9
4
+ :patch: 3
data/hyper_record.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hyper_record}
8
- s.version = "0.2.8"
8
+ s.version = "0.9.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tylerkovacs"]
12
- s.date = %q{2010-03-01}
12
+ s.date = %q{2010-05-30}
13
13
  s.description = %q{See README}
14
14
  s.email = %q{tyler.kovacs@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  "CHANGELOG",
22
22
  "LICENSE",
23
23
  "README",
24
+ "HOW_TO_RUN_TESTS",
24
25
  "Rakefile",
25
26
  "VERSION.yml",
26
27
  "benchmark/save.rb",
@@ -40,7 +41,6 @@ Gem::Specification.new do |s|
40
41
  "lib/hypertable/gen-rb/hql_types.rb",
41
42
  "lib/hypertable/thrift_client.rb",
42
43
  "lib/hypertable/thrift_transport_monkey_patch.rb",
43
- "pkg/hyper_record-0.2.8.gem",
44
44
  "spec/fixtures/pages.yml",
45
45
  "spec/fixtures/qualified_pages.yml",
46
46
  "spec/lib/associations_spec.rb",
@@ -82,8 +82,11 @@ module ActiveRecord
82
82
  end
83
83
 
84
84
  def raw_thrift_client(&block)
85
- Hypertable.with_thrift_client(@config[:host], @config[:port],
85
+ t1 = Time.now
86
+ results = Hypertable.with_thrift_client(@config[:host], @config[:port],
86
87
  @config[:timeout], &block)
88
+ @@read_latency += Time.now - t1
89
+ results
87
90
  end
88
91
 
89
92
  # Return the current set of performance statistics. The application
@@ -330,7 +333,8 @@ module ActiveRecord
330
333
  for cf in column_families
331
334
  # Columns are lazily-deleted in Hypertable so still may show up
332
335
  # in describe table output. Ignore.
333
- deleted = cf.elements['deleted'].text
336
+ del = cf.elements['deleted']
337
+ deleted = del ? del.text : 'false'
334
338
  next if deleted == 'true'
335
339
 
336
340
  column_name = cf.elements['Name'].text
@@ -526,16 +530,28 @@ module ActiveRecord
526
530
  # mutator as argument. Mutators can be created with the open_mutator
527
531
  # method. In the near future (Summer 2009), Hypertable will provide
528
532
  # a periodic mutator that automatically flushes at specific intervals.
529
- def write_cells(table_name, cells, mutator=nil, flags=nil, flush_interval=nil)
533
+ def write_cells(table_name, cells, options={})
530
534
  return if cells.blank?
531
535
 
536
+ mutator = options[:mutator]
537
+ flags = options[:flags]
538
+ flush_interval = options[:flush_interval]
539
+
532
540
  retry_on_connection_error {
533
541
  local_mutator_created = !mutator
534
542
 
535
543
  begin
536
544
  t1 = Time.now
537
545
  mutator ||= open_mutator(table_name, flags, flush_interval)
538
- @connection.set_cells_as_arrays(mutator, cells)
546
+ if options[:asynchronous_write]
547
+ mutate_spec = Hypertable::ThriftGen::MutateSpec.new
548
+ mutate_spec.appname = 'hyper_record'
549
+ mutate_spec.flush_interval = 1000
550
+ mutate_spec.flags = 2
551
+ @connection.put_cells_as_arrays(table_name, mutate_spec, cells)
552
+ else
553
+ @connection.set_cells_as_arrays(mutator, cells)
554
+ end
539
555
  ensure
540
556
  if local_mutator_created && mutator
541
557
  close_mutator(mutator)
@@ -552,11 +568,12 @@ module ActiveRecord
552
568
  # on write - used by special operations (e.g,. delete )
553
569
  def thrift_cell_from_native_array(array)
554
570
  cell = Hypertable::ThriftGen::Cell.new
555
- cell.row_key = array[0]
556
- cell.column_family = array[1]
557
- cell.column_qualifier = array[2] if !array[2].blank?
571
+ cell.key = Hypertable::ThriftGen::Key.new
572
+ cell.key.row = array[0]
573
+ cell.key.column_family = array[1]
574
+ cell.key.column_qualifier = array[2] if !array[2].blank?
558
575
  cell.value = array[3] if array[3]
559
- cell.timestamp = array[4] if array[4]
576
+ cell.key.timestamp = array[4] if array[4]
560
577
  cell
561
578
  end
562
579
 
@@ -584,7 +601,7 @@ module ActiveRecord
584
601
  @connection.with_mutator(table_name) do |mutator|
585
602
  thrift_cells = cells.map{|c|
586
603
  cell = thrift_cell_from_native_array(c)
587
- cell.flag = Hypertable::ThriftGen::CellFlag::DELETE_CELL
604
+ cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_CELL
588
605
  cell
589
606
  }
590
607
  @connection.set_cells(mutator, thrift_cells)
@@ -599,8 +616,9 @@ module ActiveRecord
599
616
  t1 = Time.now
600
617
  cells = row_keys.map do |row_key|
601
618
  cell = Hypertable::ThriftGen::Cell.new
602
- cell.row_key = row_key
603
- cell.flag = Hypertable::ThriftGen::CellFlag::DELETE_ROW
619
+ cell.key = Hypertable::ThriftGen::Key.new
620
+ cell.key.row = row_key
621
+ cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_ROW
604
622
  cell
605
623
  end
606
624
 
data/lib/hyper_record.rb CHANGED
@@ -157,6 +157,7 @@ module ActiveRecord
157
157
  def quoted_attributes_to_cells(quoted_attrs, table=self.class.table_name)
158
158
  cells = []
159
159
  pk = self.attributes[self.class.primary_key]
160
+
160
161
  quoted_attrs.keys.each{|key|
161
162
  name, qualifier = connection.hypertable_column_name(key, table).split(':', 2)
162
163
  cells << connection.cell_native_array(pk, name, qualifier, quoted_attrs[key])
@@ -179,7 +180,12 @@ module ActiveRecord
179
180
  # puts msg
180
181
  end
181
182
 
182
- connection.write_cells(table, cells, mutator, self.class.mutator_flags, self.class.mutator_flush_interval)
183
+ connection.write_cells(table, cells, {
184
+ :mutator => mutator,
185
+ :flags => self.class.mutator_flags,
186
+ :flush_interval => self.class.mutator_flush_interval,
187
+ :asynchronous_write => self.class.asynchronous_write
188
+ })
183
189
  end
184
190
 
185
191
  # Delete an array of cells from Hypertable
@@ -421,7 +427,8 @@ module ActiveRecord
421
427
  def find_by_hql(hql)
422
428
  hql_result = connection.execute(hql)
423
429
  cells_in_native_array_format = hql_result.cells.map do |c|
424
- connection.cell_native_array(c.row_key, c.column_family, c.column_qualifier, c.value)
430
+ connection.cell_native_array(c.key.row, c.key.column_family,
431
+ c.key.column_qualifier, c.value)
425
432
  end
426
433
  convert_cells_to_instantiated_rows(cells_in_native_array_format)
427
434
  end
@@ -571,11 +578,15 @@ module ActiveRecord
571
578
  end
572
579
  end
573
580
 
574
- attr_accessor :mutator, :mutator_flags, :mutator_flush_interval
581
+ attr_accessor :mutator, :mutator_flags, :mutator_flush_interval,
582
+ :asynchronous_write
583
+
575
584
  def mutator_options(*attrs)
576
585
  symbolized_attrs = attrs.first.symbolize_keys
577
586
  @mutator_flags = symbolized_attrs[:flags].to_i
578
587
  @mutator_flush_interval = symbolized_attrs[:flush_interval].to_i
588
+ @asynchronous_write = symbolized_attrs[:asynchronous_write]
589
+
579
590
  if symbolized_attrs[:persistent]
580
591
  @mutator = self.open_mutator(@mutator_flags, @mutator_flush_interval)
581
592
  end
@@ -203,6 +203,66 @@ require 'client_types'
203
203
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_cells_as_arrays failed: unknown result')
204
204
  end
205
205
 
206
+ def put_cells(tablename, mutate_spec, cells)
207
+ send_put_cells(tablename, mutate_spec, cells)
208
+ recv_put_cells()
209
+ end
210
+
211
+ def send_put_cells(tablename, mutate_spec, cells)
212
+ send_message('put_cells', Put_cells_args, :tablename => tablename, :mutate_spec => mutate_spec, :cells => cells)
213
+ end
214
+
215
+ def recv_put_cells()
216
+ result = receive_message(Put_cells_result)
217
+ raise result.e unless result.e.nil?
218
+ return
219
+ end
220
+
221
+ def put_cells_as_arrays(tablename, mutate_spec, cells)
222
+ send_put_cells_as_arrays(tablename, mutate_spec, cells)
223
+ recv_put_cells_as_arrays()
224
+ end
225
+
226
+ def send_put_cells_as_arrays(tablename, mutate_spec, cells)
227
+ send_message('put_cells_as_arrays', Put_cells_as_arrays_args, :tablename => tablename, :mutate_spec => mutate_spec, :cells => cells)
228
+ end
229
+
230
+ def recv_put_cells_as_arrays()
231
+ result = receive_message(Put_cells_as_arrays_result)
232
+ raise result.e unless result.e.nil?
233
+ return
234
+ end
235
+
236
+ def put_cell(tablename, mutate_spec, cell)
237
+ send_put_cell(tablename, mutate_spec, cell)
238
+ recv_put_cell()
239
+ end
240
+
241
+ def send_put_cell(tablename, mutate_spec, cell)
242
+ send_message('put_cell', Put_cell_args, :tablename => tablename, :mutate_spec => mutate_spec, :cell => cell)
243
+ end
244
+
245
+ def recv_put_cell()
246
+ result = receive_message(Put_cell_result)
247
+ raise result.e unless result.e.nil?
248
+ return
249
+ end
250
+
251
+ def put_cell_as_array(tablename, mutate_spec, cell)
252
+ send_put_cell_as_array(tablename, mutate_spec, cell)
253
+ recv_put_cell_as_array()
254
+ end
255
+
256
+ def send_put_cell_as_array(tablename, mutate_spec, cell)
257
+ send_message('put_cell_as_array', Put_cell_as_array_args, :tablename => tablename, :mutate_spec => mutate_spec, :cell => cell)
258
+ end
259
+
260
+ def recv_put_cell_as_array()
261
+ result = receive_message(Put_cell_as_array_result)
262
+ raise result.e unless result.e.nil?
263
+ return
264
+ end
265
+
206
266
  def open_mutator(name, flags, flush_interval)
207
267
  send_open_mutator(name, flags, flush_interval)
208
268
  return recv_open_mutator()
@@ -309,6 +369,22 @@ require 'client_types'
309
369
  return
310
370
  end
311
371
 
372
+ def exists_table(name)
373
+ send_exists_table(name)
374
+ return recv_exists_table()
375
+ end
376
+
377
+ def send_exists_table(name)
378
+ send_message('exists_table', Exists_table_args, :name => name)
379
+ end
380
+
381
+ def recv_exists_table()
382
+ result = receive_message(Exists_table_result)
383
+ return result.success unless result.success.nil?
384
+ raise result.e unless result.e.nil?
385
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'exists_table failed: unknown result')
386
+ end
387
+
312
388
  def get_table_id(name)
313
389
  send_get_table_id(name)
314
390
  return recv_get_table_id()
@@ -357,6 +433,22 @@ require 'client_types'
357
433
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_tables failed: unknown result')
358
434
  end
359
435
 
436
+ def get_table_splits(name)
437
+ send_get_table_splits(name)
438
+ return recv_get_table_splits()
439
+ end
440
+
441
+ def send_get_table_splits(name)
442
+ send_message('get_table_splits', Get_table_splits_args, :name => name)
443
+ end
444
+
445
+ def recv_get_table_splits()
446
+ result = receive_message(Get_table_splits_result)
447
+ return result.success unless result.success.nil?
448
+ raise result.e unless result.e.nil?
449
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_table_splits failed: unknown result')
450
+ end
451
+
360
452
  def drop_table(name, if_exists)
361
453
  send_drop_table(name, if_exists)
362
454
  recv_drop_table()
@@ -509,6 +601,50 @@ require 'client_types'
509
601
  write_result(result, oprot, 'get_cells_as_arrays', seqid)
510
602
  end
511
603
 
604
+ def process_put_cells(seqid, iprot, oprot)
605
+ args = read_args(iprot, Put_cells_args)
606
+ result = Put_cells_result.new()
607
+ begin
608
+ @handler.put_cells(args.tablename, args.mutate_spec, args.cells)
609
+ rescue Hypertable::ThriftGen::ClientException => e
610
+ result.e = e
611
+ end
612
+ write_result(result, oprot, 'put_cells', seqid)
613
+ end
614
+
615
+ def process_put_cells_as_arrays(seqid, iprot, oprot)
616
+ args = read_args(iprot, Put_cells_as_arrays_args)
617
+ result = Put_cells_as_arrays_result.new()
618
+ begin
619
+ @handler.put_cells_as_arrays(args.tablename, args.mutate_spec, args.cells)
620
+ rescue Hypertable::ThriftGen::ClientException => e
621
+ result.e = e
622
+ end
623
+ write_result(result, oprot, 'put_cells_as_arrays', seqid)
624
+ end
625
+
626
+ def process_put_cell(seqid, iprot, oprot)
627
+ args = read_args(iprot, Put_cell_args)
628
+ result = Put_cell_result.new()
629
+ begin
630
+ @handler.put_cell(args.tablename, args.mutate_spec, args.cell)
631
+ rescue Hypertable::ThriftGen::ClientException => e
632
+ result.e = e
633
+ end
634
+ write_result(result, oprot, 'put_cell', seqid)
635
+ end
636
+
637
+ def process_put_cell_as_array(seqid, iprot, oprot)
638
+ args = read_args(iprot, Put_cell_as_array_args)
639
+ result = Put_cell_as_array_result.new()
640
+ begin
641
+ @handler.put_cell_as_array(args.tablename, args.mutate_spec, args.cell)
642
+ rescue Hypertable::ThriftGen::ClientException => e
643
+ result.e = e
644
+ end
645
+ write_result(result, oprot, 'put_cell_as_array', seqid)
646
+ end
647
+
512
648
  def process_open_mutator(seqid, iprot, oprot)
513
649
  args = read_args(iprot, Open_mutator_args)
514
650
  result = Open_mutator_result.new()
@@ -586,6 +722,17 @@ require 'client_types'
586
722
  write_result(result, oprot, 'flush_mutator', seqid)
587
723
  end
588
724
 
725
+ def process_exists_table(seqid, iprot, oprot)
726
+ args = read_args(iprot, Exists_table_args)
727
+ result = Exists_table_result.new()
728
+ begin
729
+ result.success = @handler.exists_table(args.name)
730
+ rescue Hypertable::ThriftGen::ClientException => e
731
+ result.e = e
732
+ end
733
+ write_result(result, oprot, 'exists_table', seqid)
734
+ end
735
+
589
736
  def process_get_table_id(seqid, iprot, oprot)
590
737
  args = read_args(iprot, Get_table_id_args)
591
738
  result = Get_table_id_result.new()
@@ -619,6 +766,17 @@ require 'client_types'
619
766
  write_result(result, oprot, 'get_tables', seqid)
620
767
  end
621
768
 
769
+ def process_get_table_splits(seqid, iprot, oprot)
770
+ args = read_args(iprot, Get_table_splits_args)
771
+ result = Get_table_splits_result.new()
772
+ begin
773
+ result.success = @handler.get_table_splits(args.name)
774
+ rescue Hypertable::ThriftGen::ClientException => e
775
+ result.e = e
776
+ end
777
+ write_result(result, oprot, 'get_table_splits', seqid)
778
+ end
779
+
622
780
  def process_drop_table(seqid, iprot, oprot)
623
781
  args = read_args(iprot, Drop_table_args)
624
782
  result = Drop_table_result.new()
@@ -1056,6 +1214,150 @@ require 'client_types'
1056
1214
 
1057
1215
  end
1058
1216
 
1217
+ class Put_cells_args
1218
+ include ::Thrift::Struct
1219
+ TABLENAME = 1
1220
+ MUTATE_SPEC = 2
1221
+ CELLS = 3
1222
+
1223
+ ::Thrift::Struct.field_accessor self, :tablename, :mutate_spec, :cells
1224
+ FIELDS = {
1225
+ TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'},
1226
+ MUTATE_SPEC => {:type => ::Thrift::Types::STRUCT, :name => 'mutate_spec', :class => Hypertable::ThriftGen::MutateSpec},
1227
+ CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::STRUCT, :class => Hypertable::ThriftGen::Cell}}
1228
+ }
1229
+
1230
+ def struct_fields; FIELDS; end
1231
+
1232
+ def validate
1233
+ end
1234
+
1235
+ end
1236
+
1237
+ class Put_cells_result
1238
+ include ::Thrift::Struct
1239
+ E = 1
1240
+
1241
+ ::Thrift::Struct.field_accessor self, :e
1242
+ FIELDS = {
1243
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1244
+ }
1245
+
1246
+ def struct_fields; FIELDS; end
1247
+
1248
+ def validate
1249
+ end
1250
+
1251
+ end
1252
+
1253
+ class Put_cells_as_arrays_args
1254
+ include ::Thrift::Struct
1255
+ TABLENAME = 1
1256
+ MUTATE_SPEC = 2
1257
+ CELLS = 3
1258
+
1259
+ ::Thrift::Struct.field_accessor self, :tablename, :mutate_spec, :cells
1260
+ FIELDS = {
1261
+ TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'},
1262
+ MUTATE_SPEC => {:type => ::Thrift::Types::STRUCT, :name => 'mutate_spec', :class => Hypertable::ThriftGen::MutateSpec},
1263
+ CELLS => {:type => ::Thrift::Types::LIST, :name => 'cells', :element => {:type => ::Thrift::Types::LIST, :element => {:type => ::Thrift::Types::STRING}}}
1264
+ }
1265
+
1266
+ def struct_fields; FIELDS; end
1267
+
1268
+ def validate
1269
+ end
1270
+
1271
+ end
1272
+
1273
+ class Put_cells_as_arrays_result
1274
+ include ::Thrift::Struct
1275
+ E = 1
1276
+
1277
+ ::Thrift::Struct.field_accessor self, :e
1278
+ FIELDS = {
1279
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1280
+ }
1281
+
1282
+ def struct_fields; FIELDS; end
1283
+
1284
+ def validate
1285
+ end
1286
+
1287
+ end
1288
+
1289
+ class Put_cell_args
1290
+ include ::Thrift::Struct
1291
+ TABLENAME = 1
1292
+ MUTATE_SPEC = 2
1293
+ CELL = 3
1294
+
1295
+ ::Thrift::Struct.field_accessor self, :tablename, :mutate_spec, :cell
1296
+ FIELDS = {
1297
+ TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'},
1298
+ MUTATE_SPEC => {:type => ::Thrift::Types::STRUCT, :name => 'mutate_spec', :class => Hypertable::ThriftGen::MutateSpec},
1299
+ CELL => {:type => ::Thrift::Types::STRUCT, :name => 'cell', :class => Hypertable::ThriftGen::Cell}
1300
+ }
1301
+
1302
+ def struct_fields; FIELDS; end
1303
+
1304
+ def validate
1305
+ end
1306
+
1307
+ end
1308
+
1309
+ class Put_cell_result
1310
+ include ::Thrift::Struct
1311
+ E = 1
1312
+
1313
+ ::Thrift::Struct.field_accessor self, :e
1314
+ FIELDS = {
1315
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1316
+ }
1317
+
1318
+ def struct_fields; FIELDS; end
1319
+
1320
+ def validate
1321
+ end
1322
+
1323
+ end
1324
+
1325
+ class Put_cell_as_array_args
1326
+ include ::Thrift::Struct
1327
+ TABLENAME = 1
1328
+ MUTATE_SPEC = 2
1329
+ CELL = 3
1330
+
1331
+ ::Thrift::Struct.field_accessor self, :tablename, :mutate_spec, :cell
1332
+ FIELDS = {
1333
+ TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'},
1334
+ MUTATE_SPEC => {:type => ::Thrift::Types::STRUCT, :name => 'mutate_spec', :class => Hypertable::ThriftGen::MutateSpec},
1335
+ CELL => {:type => ::Thrift::Types::LIST, :name => 'cell', :element => {:type => ::Thrift::Types::STRING}}
1336
+ }
1337
+
1338
+ def struct_fields; FIELDS; end
1339
+
1340
+ def validate
1341
+ end
1342
+
1343
+ end
1344
+
1345
+ class Put_cell_as_array_result
1346
+ include ::Thrift::Struct
1347
+ E = 1
1348
+
1349
+ ::Thrift::Struct.field_accessor self, :e
1350
+ FIELDS = {
1351
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1352
+ }
1353
+
1354
+ def struct_fields; FIELDS; end
1355
+
1356
+ def validate
1357
+ end
1358
+
1359
+ end
1360
+
1059
1361
  class Open_mutator_args
1060
1362
  include ::Thrift::Struct
1061
1363
  NAME = 1
@@ -1296,6 +1598,40 @@ require 'client_types'
1296
1598
 
1297
1599
  end
1298
1600
 
1601
+ class Exists_table_args
1602
+ include ::Thrift::Struct
1603
+ NAME = 1
1604
+
1605
+ ::Thrift::Struct.field_accessor self, :name
1606
+ FIELDS = {
1607
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
1608
+ }
1609
+
1610
+ def struct_fields; FIELDS; end
1611
+
1612
+ def validate
1613
+ end
1614
+
1615
+ end
1616
+
1617
+ class Exists_table_result
1618
+ include ::Thrift::Struct
1619
+ SUCCESS = 0
1620
+ E = 1
1621
+
1622
+ ::Thrift::Struct.field_accessor self, :success, :e
1623
+ FIELDS = {
1624
+ SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
1625
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1626
+ }
1627
+
1628
+ def struct_fields; FIELDS; end
1629
+
1630
+ def validate
1631
+ end
1632
+
1633
+ end
1634
+
1299
1635
  class Get_table_id_args
1300
1636
  include ::Thrift::Struct
1301
1637
  NAME = 1
@@ -1396,6 +1732,40 @@ require 'client_types'
1396
1732
 
1397
1733
  end
1398
1734
 
1735
+ class Get_table_splits_args
1736
+ include ::Thrift::Struct
1737
+ NAME = 1
1738
+
1739
+ ::Thrift::Struct.field_accessor self, :name
1740
+ FIELDS = {
1741
+ NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
1742
+ }
1743
+
1744
+ def struct_fields; FIELDS; end
1745
+
1746
+ def validate
1747
+ end
1748
+
1749
+ end
1750
+
1751
+ class Get_table_splits_result
1752
+ include ::Thrift::Struct
1753
+ SUCCESS = 0
1754
+ E = 1
1755
+
1756
+ ::Thrift::Struct.field_accessor self, :success, :e
1757
+ FIELDS = {
1758
+ SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => Hypertable::ThriftGen::TableSplit}},
1759
+ E => {:type => ::Thrift::Types::STRUCT, :name => 'e', :class => Hypertable::ThriftGen::ClientException}
1760
+ }
1761
+
1762
+ def struct_fields; FIELDS; end
1763
+
1764
+ def validate
1765
+ end
1766
+
1767
+ end
1768
+
1399
1769
  class Drop_table_args
1400
1770
  include ::Thrift::Struct
1401
1771
  NAME = 1
@@ -18,8 +18,9 @@ module Hypertable
18
18
 
19
19
  module MutatorFlag
20
20
  NO_LOG_SYNC = 1
21
- VALUE_MAP = {1 => "NO_LOG_SYNC"}
22
- VALID_VALUES = Set.new([NO_LOG_SYNC]).freeze
21
+ IGNORE_UNKNOWN_CFS = 2
22
+ VALUE_MAP = {1 => "NO_LOG_SYNC", 2 => "IGNORE_UNKNOWN_CFS"}
23
+ VALID_VALUES = Set.new([NO_LOG_SYNC, IGNORE_UNKNOWN_CFS]).freeze
23
24
  end
24
25
 
25
26
  # Specifies a range of rows
@@ -148,8 +149,9 @@ module Hypertable
148
149
  START_TIME = 6
149
150
  END_TIME = 7
150
151
  COLUMNS = 8
152
+ KEYS_ONLY = 9
151
153
 
152
- ::Thrift::Struct.field_accessor self, :row_intervals, :cell_intervals, :return_deletes, :revs, :row_limit, :start_time, :end_time, :columns
154
+ ::Thrift::Struct.field_accessor self, :row_intervals, :cell_intervals, :return_deletes, :revs, :row_limit, :start_time, :end_time, :columns, :keys_only
153
155
  FIELDS = {
154
156
  ROW_INTERVALS => {:type => ::Thrift::Types::LIST, :name => 'row_intervals', :element => {:type => ::Thrift::Types::STRUCT, :class => Hypertable::ThriftGen::RowInterval}, :optional => true},
155
157
  CELL_INTERVALS => {:type => ::Thrift::Types::LIST, :name => 'cell_intervals', :element => {:type => ::Thrift::Types::STRUCT, :class => Hypertable::ThriftGen::CellInterval}, :optional => true},
@@ -158,7 +160,8 @@ module Hypertable
158
160
  ROW_LIMIT => {:type => ::Thrift::Types::I32, :name => 'row_limit', :default => 0, :optional => true},
159
161
  START_TIME => {:type => ::Thrift::Types::I64, :name => 'start_time', :optional => true},
160
162
  END_TIME => {:type => ::Thrift::Types::I64, :name => 'end_time', :optional => true},
161
- COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRING}, :optional => true}
163
+ COLUMNS => {:type => ::Thrift::Types::LIST, :name => 'columns', :element => {:type => ::Thrift::Types::STRING}, :optional => true},
164
+ KEYS_ONLY => {:type => ::Thrift::Types::BOOL, :name => 'keys_only', :default => false, :optional => true}
162
165
  }
163
166
 
164
167
  def struct_fields; FIELDS; end
@@ -168,10 +171,10 @@ module Hypertable
168
171
 
169
172
  end
170
173
 
171
- # Defines a table cell
174
+ # Defines a cell key
172
175
  #
173
176
  # <dl>
174
- # <dt>row_key</dt>
177
+ # <dt>row</dt>
175
178
  # <dd>Specifies the row key. Note, it cannot contain null characters.
176
179
  # If a row key is not specified in a return cell, it's assumed to
177
180
  # be the same as the previous cell</dd>
@@ -182,9 +185,6 @@ module Hypertable
182
185
  # <dt>column_qualifier</dt>
183
186
  # <dd>Specifies the column qualifier. A column family must be specified.</dd>
184
187
  #
185
- # <dt>value</dt>
186
- # <dd>Value of a cell. Currently a sequence of uninterpreted bytes.</dd>
187
- #
188
188
  # <dt>timestamp</dt>
189
189
  # <dd>Nanoseconds since epoch for the cell<dd>
190
190
  #
@@ -194,25 +194,122 @@ module Hypertable
194
194
  # <dt>flag</dt>
195
195
  # <dd>A 16-bit integer indicating the state of the cell</dd>
196
196
  # </dl>
197
- class Cell
197
+ class Key
198
198
  include ::Thrift::Struct
199
- ROW_KEY = 1
199
+ ROW = 1
200
200
  COLUMN_FAMILY = 2
201
201
  COLUMN_QUALIFIER = 3
202
- VALUE = 4
203
- TIMESTAMP = 5
204
- REVISION = 6
205
- FLAG = 7
202
+ TIMESTAMP = 4
203
+ REVISION = 5
204
+ FLAG = 6
206
205
 
207
- ::Thrift::Struct.field_accessor self, :row_key, :column_family, :column_qualifier, :value, :timestamp, :revision, :flag
206
+ ::Thrift::Struct.field_accessor self, :row, :column_family, :column_qualifier, :timestamp, :revision, :flag
208
207
  FIELDS = {
209
- ROW_KEY => {:type => ::Thrift::Types::STRING, :name => 'row_key', :optional => true},
210
- COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family', :optional => true},
211
- COLUMN_QUALIFIER => {:type => ::Thrift::Types::STRING, :name => 'column_qualifier', :optional => true},
212
- VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :optional => true},
208
+ ROW => {:type => ::Thrift::Types::STRING, :name => 'row'},
209
+ COLUMN_FAMILY => {:type => ::Thrift::Types::STRING, :name => 'column_family'},
210
+ COLUMN_QUALIFIER => {:type => ::Thrift::Types::STRING, :name => 'column_qualifier'},
213
211
  TIMESTAMP => {:type => ::Thrift::Types::I64, :name => 'timestamp', :optional => true},
214
212
  REVISION => {:type => ::Thrift::Types::I64, :name => 'revision', :optional => true},
215
- FLAG => {:type => ::Thrift::Types::I16, :name => 'flag', :default => 255, :optional => true}
213
+ FLAG => {:type => ::Thrift::Types::I16, :name => 'flag', :default => 255}
214
+ }
215
+
216
+ def struct_fields; FIELDS; end
217
+
218
+ def validate
219
+ end
220
+
221
+ end
222
+
223
+ # Specifies options for a shared periodic mutator
224
+ #
225
+ # <dl>
226
+ # <dt>appname</dt>
227
+ # <dd>String key used to share/retrieve mutator, eg: "my_ht_app"</dd>
228
+ #
229
+ # <dt>flush_interval</dt>
230
+ # <dd>Time interval between flushes</dd>
231
+ #
232
+ # <dt>flags</dt>
233
+ # <dd>Mutator flags</dt>
234
+ # </dl>
235
+ class MutateSpec
236
+ include ::Thrift::Struct
237
+ APPNAME = 1
238
+ FLUSH_INTERVAL = 2
239
+ FLAGS = 3
240
+
241
+ ::Thrift::Struct.field_accessor self, :appname, :flush_interval, :flags
242
+ FIELDS = {
243
+ APPNAME => {:type => ::Thrift::Types::STRING, :name => 'appname', :default => %q""},
244
+ FLUSH_INTERVAL => {:type => ::Thrift::Types::I32, :name => 'flush_interval', :default => 1000},
245
+ FLAGS => {:type => ::Thrift::Types::I32, :name => 'flags', :default => 2}
246
+ }
247
+
248
+ def struct_fields; FIELDS; end
249
+
250
+ def validate
251
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field appname is unset!') unless @appname
252
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field flush_interval is unset!') unless @flush_interval
253
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field flags is unset!') unless @flags
254
+ end
255
+
256
+ end
257
+
258
+ # Defines a table cell
259
+ #
260
+ # <dl>
261
+ # <dt>key</dt>
262
+ # <dd>Specifies the cell key</dd>
263
+ #
264
+ # <dt>value</dt>
265
+ # <dd>Value of a cell. Currently a sequence of uninterpreted bytes.</dd>
266
+ # </dl>
267
+ class Cell
268
+ include ::Thrift::Struct
269
+ KEY = 1
270
+ VALUE = 2
271
+
272
+ ::Thrift::Struct.field_accessor self, :key, :value
273
+ FIELDS = {
274
+ KEY => {:type => ::Thrift::Types::STRUCT, :name => 'key', :class => Hypertable::ThriftGen::Key},
275
+ VALUE => {:type => ::Thrift::Types::STRING, :name => 'value', :optional => true}
276
+ }
277
+
278
+ def struct_fields; FIELDS; end
279
+
280
+ def validate
281
+ end
282
+
283
+ end
284
+
285
+ # Defines a table split
286
+ #
287
+ # <dl>
288
+ # <dt>start_row</dt>
289
+ # <dd>Starting row of the split.</dd>
290
+ #
291
+ # <dt>end_row</dt>
292
+ # <dd>Ending row of the split.</dd>
293
+ #
294
+ # <dt>location</dt>
295
+ # <dd>Location (proxy name) of the split.</dd>
296
+ #
297
+ # <dt>ip_address</dt>
298
+ # <dd>The IP address of the split.</dd>
299
+ # </dl>
300
+ class TableSplit
301
+ include ::Thrift::Struct
302
+ START_ROW = 1
303
+ END_ROW = 2
304
+ LOCATION = 3
305
+ IP_ADDRESS = 4
306
+
307
+ ::Thrift::Struct.field_accessor self, :start_row, :end_row, :location, :ip_address
308
+ FIELDS = {
309
+ START_ROW => {:type => ::Thrift::Types::STRING, :name => 'start_row', :optional => true},
310
+ END_ROW => {:type => ::Thrift::Types::STRING, :name => 'end_row', :optional => true},
311
+ LOCATION => {:type => ::Thrift::Types::STRING, :name => 'location', :optional => true},
312
+ IP_ADDRESS => {:type => ::Thrift::Types::STRING, :name => 'ip_address', :optional => true}
216
313
  }
217
314
 
218
315
  def struct_fields; FIELDS; end
@@ -842,6 +842,59 @@ module ActiveRecord
842
842
  it "should support native each_row_as_arrays scanner method"
843
843
  end
844
844
 
845
+ describe HyperBase, '.mutator_options' do
846
+ it 'should default to set_cells method' do
847
+ class Temp < ActiveRecord::HyperBase
848
+ def self.create_table
849
+ hql = "CREATE TABLE #{table_name} (
850
+ 'name',
851
+ 'url'
852
+ )"
853
+ connection.execute(hql)
854
+ end
855
+ end
856
+
857
+ Temp.drop_table
858
+ Temp.create_table
859
+ Temp.connection.instance_eval("@connection").should_receive(:set_cells_as_arrays).and_return(nil)
860
+ t = Temp.new({:ROW => 'test', :name => 'test'})
861
+ t.save!
862
+ Temp.drop_table
863
+ end
864
+
865
+ describe 'asynchronous_write' do
866
+ before(:each) do
867
+ class Temp < ActiveRecord::HyperBase
868
+ mutator_options :asynchronous_write => true
869
+
870
+ def self.create_table
871
+ hql = "CREATE TABLE #{table_name} (
872
+ 'name',
873
+ 'url'
874
+ )"
875
+ connection.execute(hql)
876
+ end
877
+
878
+ Temp.drop_table
879
+ Temp.create_table
880
+ end
881
+ end
882
+
883
+ it 'should use put_cells method when asynchronous_write enabled' do
884
+ Temp.connection.instance_eval("@connection").should_receive(:put_cells_as_arrays).and_return(nil)
885
+ t = Temp.new({:ROW => 'test', :name => 'test'})
886
+ t.save!
887
+ end
888
+
889
+ it 'should still result in cells being written to hypertable' do
890
+ t = Temp.new({:ROW => 'test', :name => 'test'})
891
+ t.save!
892
+ sleep 3
893
+ Temp.find('test').should == t
894
+ end
895
+ end
896
+ end
897
+
845
898
  describe HyperBase, '.row_key_attributes' do
846
899
  it "should assemble a row key in the order that matches row key attributes" do
847
900
  Page.class_eval do
@@ -212,8 +212,8 @@ class ThriftClientTest < Test::Unit::TestCase
212
212
 
213
213
  query = client.hql_query("SELECT * FROM thrift_test")
214
214
  assert_equal 1, query.cells.length
215
- assert_equal 'k1', query.cells[0].row_key
216
- assert_equal 'col', query.cells[0].column_family
215
+ assert_equal 'k1', query.cells[0].key.row
216
+ assert_equal 'col', query.cells[0].key.column_family
217
217
  assert_equal 'v1', query.cells[0].value
218
218
  end
219
219
  end
@@ -222,16 +222,17 @@ class ThriftClientTest < Test::Unit::TestCase
222
222
  Hypertable.with_thrift_client("localhost", 38080) do |client|
223
223
  mutator = client.open_mutator('thrift_test', 0, 0)
224
224
  cell1 = Hypertable::ThriftGen::Cell.new
225
- cell1.row_key = 'k1'
226
- cell1.column_family = 'col'
225
+ cell1.key = Hypertable::ThriftGen::Key.new
226
+ cell1.key.row = 'k1'
227
+ cell1.key.column_family = 'col'
227
228
  cell1.value = 'v1'
228
229
  client.set_cell(mutator, cell1)
229
230
  client.close_mutator(mutator, true)
230
231
 
231
232
  query = client.hql_query("SELECT * FROM thrift_test")
232
233
  assert_equal 1, query.cells.length
233
- assert_equal 'k1', query.cells[0].row_key
234
- assert_equal 'col', query.cells[0].column_family
234
+ assert_equal 'k1', query.cells[0].key.row
235
+ assert_equal 'col', query.cells[0].key.column_family
235
236
  assert_equal 'v1', query.cells[0].value
236
237
  end
237
238
  end
@@ -240,8 +241,9 @@ class ThriftClientTest < Test::Unit::TestCase
240
241
  Hypertable.with_thrift_client("localhost", 38080) do |client|
241
242
  mutator = client.open_mutator('thrift_test', 0, 500)
242
243
  cell1 = Hypertable::ThriftGen::Cell.new
243
- cell1.row_key = 'k1'
244
- cell1.column_family = 'col'
244
+ cell1.key = Hypertable::ThriftGen::Key.new
245
+ cell1.key.row = 'k1'
246
+ cell1.key.column_family = 'col'
245
247
  cell1.value = 'v1'
246
248
  client.set_cell(mutator, cell1)
247
249
 
@@ -252,8 +254,8 @@ class ThriftClientTest < Test::Unit::TestCase
252
254
 
253
255
  query = client.hql_query("SELECT * FROM thrift_test")
254
256
  assert_equal 1, query.cells.length
255
- assert_equal 'k1', query.cells[0].row_key
256
- assert_equal 'col', query.cells[0].column_family
257
+ assert_equal 'k1', query.cells[0].key.row
258
+ assert_equal 'col', query.cells[0].key.column_family
257
259
  assert_equal 'v1', query.cells[0].value
258
260
  end
259
261
  end
@@ -276,16 +278,16 @@ class ThriftClientTest < Test::Unit::TestCase
276
278
 
277
279
  query = client.hql_query("SELECT * FROM thrift_test")
278
280
  assert_equal 3, query.cells.length
279
- assert_equal 'k1', query.cells[0].row_key
280
- assert_equal 'col', query.cells[0].column_family
281
+ assert_equal 'k1', query.cells[0].key.row
282
+ assert_equal 'col', query.cells[0].key.column_family
281
283
  assert_equal 'v1', query.cells[0].value
282
284
 
283
- assert_equal 'k2', query.cells[1].row_key
284
- assert_equal 'col', query.cells[1].column_family
285
+ assert_equal 'k2', query.cells[1].key.row
286
+ assert_equal 'col', query.cells[1].key.column_family
285
287
  assert_equal 'v2', query.cells[1].value
286
288
 
287
- assert_equal 'k3', query.cells[2].row_key
288
- assert_equal 'col', query.cells[2].column_family
289
+ assert_equal 'k3', query.cells[2].key.row
290
+ assert_equal 'col', query.cells[2].key.column_family
289
291
  assert_equal 'v3', query.cells[2].value
290
292
  end
291
293
  end
@@ -294,18 +296,21 @@ class ThriftClientTest < Test::Unit::TestCase
294
296
  Hypertable.with_thrift_client("localhost", 38080) do |client|
295
297
  mutator = client.open_mutator('thrift_test', 0, 0)
296
298
  cell1 = Hypertable::ThriftGen::Cell.new
297
- cell1.row_key = 'k1'
298
- cell1.column_family = 'col'
299
+ cell1.key = Hypertable::ThriftGen::Key.new
300
+ cell1.key.row = 'k1'
301
+ cell1.key.column_family = 'col'
299
302
  cell1.value = 'v1'
300
303
 
301
304
  cell2 = Hypertable::ThriftGen::Cell.new
302
- cell2.row_key = 'k2'
303
- cell2.column_family = 'col'
305
+ cell2.key = Hypertable::ThriftGen::Key.new
306
+ cell2.key.row = 'k2'
307
+ cell2.key.column_family = 'col'
304
308
  cell2.value = 'v2'
305
309
 
306
310
  cell3 = Hypertable::ThriftGen::Cell.new
307
- cell3.row_key = 'k3'
308
- cell3.column_family = 'col'
311
+ cell3.key = Hypertable::ThriftGen::Key.new
312
+ cell3.key.row = 'k3'
313
+ cell3.key.column_family = 'col'
309
314
  cell3.value = 'v3'
310
315
 
311
316
  client.set_cells(mutator, [cell1, cell2, cell3])
@@ -313,16 +318,16 @@ class ThriftClientTest < Test::Unit::TestCase
313
318
 
314
319
  query = client.hql_query("SELECT * FROM thrift_test")
315
320
  assert_equal 3, query.cells.length
316
- assert_equal 'k1', query.cells[0].row_key
317
- assert_equal 'col', query.cells[0].column_family
321
+ assert_equal 'k1', query.cells[0].key.row
322
+ assert_equal 'col', query.cells[0].key.column_family
318
323
  assert_equal 'v1', query.cells[0].value
319
324
 
320
- assert_equal 'k2', query.cells[1].row_key
321
- assert_equal 'col', query.cells[1].column_family
325
+ assert_equal 'k2', query.cells[1].key.row
326
+ assert_equal 'col', query.cells[1].key.column_family
322
327
  assert_equal 'v2', query.cells[1].value
323
328
 
324
- assert_equal 'k3', query.cells[2].row_key
325
- assert_equal 'col', query.cells[2].column_family
329
+ assert_equal 'k3', query.cells[2].key.row
330
+ assert_equal 'col', query.cells[2].key.column_family
326
331
  assert_equal 'v3', query.cells[2].value
327
332
  end
328
333
  end
@@ -343,16 +348,17 @@ class ThriftClientTest < Test::Unit::TestCase
343
348
 
344
349
  client.with_mutator('thrift_test') do |mutator|
345
350
  cell1 = Hypertable::ThriftGen::Cell.new
346
- cell1.row_key = 'k1'
347
- cell1.column_family = 'col'
351
+ cell1.key = Hypertable::ThriftGen::Key.new
352
+ cell1.key.row = 'k1'
353
+ cell1.key.column_family = 'col'
348
354
  cell1.value = 'v1'
349
355
  client.set_cells(mutator, [cell1])
350
356
  end
351
357
 
352
358
  query = client.hql_query("SELECT * FROM thrift_test")
353
359
  assert_equal 1, query.cells.length
354
- assert_equal 'k1', query.cells[0].row_key
355
- assert_equal 'col', query.cells[0].column_family
360
+ assert_equal 'k1', query.cells[0].key.row
361
+ assert_equal 'col', query.cells[0].key.column_family
356
362
  assert_equal 'v1', query.cells[0].value
357
363
  end
358
364
  end
@@ -374,8 +380,8 @@ class ThriftClientTest < Test::Unit::TestCase
374
380
  Hypertable.with_thrift_client("localhost", 38080) do |client|
375
381
  query = client.hql_query("SELECT * FROM thrift_test WHERE CELL = 'k1','col'")
376
382
  assert_equal 1, query.cells.length
377
- assert_equal 'k1', query.cells[0].row_key
378
- assert_equal 'col', query.cells[0].column_family
383
+ assert_equal 'k1', query.cells[0].key.row
384
+ assert_equal 'col', query.cells[0].key.column_family
379
385
  assert_equal 'v1', query.cells[0].value
380
386
  end
381
387
  end
@@ -404,8 +410,8 @@ class ThriftClientTest < Test::Unit::TestCase
404
410
  Hypertable.with_thrift_client("localhost", 38080) do |client|
405
411
  query = client.hql_query("SELECT * FROM thrift_test WHERE ROW = 'k1'")
406
412
  assert_equal 1, query.cells.length
407
- assert_equal 'k1', query.cells[0].row_key
408
- assert_equal 'col', query.cells[0].column_family
413
+ assert_equal 'k1', query.cells[0].key.row
414
+ assert_equal 'col', query.cells[0].key.column_family
409
415
  assert_equal 'v1', query.cells[0].value
410
416
  end
411
417
  end
@@ -414,8 +420,8 @@ class ThriftClientTest < Test::Unit::TestCase
414
420
  Hypertable.with_thrift_client("localhost", 38080) do |client|
415
421
  cells = client.get_row("thrift_test", 'k1')
416
422
  assert_equal 1, cells.length
417
- assert_equal 'k1', cells[0].row_key
418
- assert_equal 'col', cells[0].column_family
423
+ assert_equal 'k1', cells[0].key.row
424
+ assert_equal 'col', cells[0].key.column_family
419
425
  assert_equal 'v1', cells[0].value
420
426
  end
421
427
  end
@@ -437,16 +443,16 @@ class ThriftClientTest < Test::Unit::TestCase
437
443
  Hypertable.with_thrift_client("localhost", 38080) do |client|
438
444
  query = client.hql_query("SELECT * FROM thrift_test")
439
445
  assert_equal 3, query.cells.length
440
- assert_equal 'k1', query.cells[0].row_key
441
- assert_equal 'col', query.cells[0].column_family
446
+ assert_equal 'k1', query.cells[0].key.row
447
+ assert_equal 'col', query.cells[0].key.column_family
442
448
  assert_equal 'v1', query.cells[0].value
443
449
 
444
- assert_equal 'k2', query.cells[1].row_key
445
- assert_equal 'col', query.cells[1].column_family
450
+ assert_equal 'k2', query.cells[1].key.row
451
+ assert_equal 'col', query.cells[1].key.column_family
446
452
  assert_equal 'v2', query.cells[1].value
447
453
 
448
- assert_equal 'k3', query.cells[2].row_key
449
- assert_equal 'col', query.cells[2].column_family
454
+ assert_equal 'k3', query.cells[2].key.row
455
+ assert_equal 'col', query.cells[2].key.column_family
450
456
  assert_equal 'v3', query.cells[2].value
451
457
  end
452
458
  end
@@ -457,16 +463,16 @@ class ThriftClientTest < Test::Unit::TestCase
457
463
  cells = client.get_cells("thrift_test", scan_spec)
458
464
 
459
465
  assert_equal 3, cells.length
460
- assert_equal 'k1', cells[0].row_key
461
- assert_equal 'col', cells[0].column_family
466
+ assert_equal 'k1', cells[0].key.row
467
+ assert_equal 'col', cells[0].key.column_family
462
468
  assert_equal 'v1', cells[0].value
463
469
 
464
- assert_equal 'k2', cells[1].row_key
465
- assert_equal 'col', cells[1].column_family
470
+ assert_equal 'k2', cells[1].key.row
471
+ assert_equal 'col', cells[1].key.column_family
466
472
  assert_equal 'v2', cells[1].value
467
473
 
468
- assert_equal 'k3', cells[2].row_key
469
- assert_equal 'col', cells[2].column_family
474
+ assert_equal 'k3', cells[2].key.row
475
+ assert_equal 'col', cells[2].key.column_family
470
476
  assert_equal 'v3', cells[2].value
471
477
  end
472
478
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 8
9
- version: 0.2.8
7
+ - 9
8
+ - 3
9
+ version: 0.9.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - tylerkovacs
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-01 00:00:00 -08:00
17
+ date: 2010-05-30 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -32,6 +32,7 @@ files:
32
32
  - CHANGELOG
33
33
  - LICENSE
34
34
  - README
35
+ - HOW_TO_RUN_TESTS
35
36
  - Rakefile
36
37
  - VERSION.yml
37
38
  - benchmark/save.rb
@@ -51,7 +52,6 @@ files:
51
52
  - lib/hypertable/gen-rb/hql_types.rb
52
53
  - lib/hypertable/thrift_client.rb
53
54
  - lib/hypertable/thrift_transport_monkey_patch.rb
54
- - pkg/hyper_record-0.2.8.gem
55
55
  - spec/fixtures/pages.yml
56
56
  - spec/fixtures/qualified_pages.yml
57
57
  - spec/lib/associations_spec.rb
Binary file