hyper_record 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ 0.9.4.0 (2010/10/27)
2
+ - now compatible with Hypertable 0.9.4.0
3
+ - note: not backwards compatible with previous Hypertable releases due
4
+ to API changes
5
+
6
+ 0.9.3.4 (no official release)
7
+ - now compatible with Thrift 0.3.0 and Hypertable 0.9.3.4
8
+ - note: not backwards compatible with previous Thrift or Hypertable releases
9
+
1
10
  0.9.3.0 (2010/05/30)
2
11
  - updated HyperRecord version numbers to match Hypertable release number
3
12
  - now compatible with Hypertable version 0.9.3.0
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 9
4
- :patch: 3
4
+ :patch: 4
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.9.3"
8
+ s.version = "0.9.4"
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-05-30}
12
+ s.date = %q{2010-10-27}
13
13
  s.description = %q{See README}
14
14
  s.email = %q{tyler.kovacs@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".gitignore",
21
21
  "CHANGELOG",
22
+ "HOW_TO_RUN_TESTS",
22
23
  "LICENSE",
23
24
  "README",
24
- "HOW_TO_RUN_TESTS",
25
25
  "Rakefile",
26
26
  "VERSION.yml",
27
27
  "benchmark/save.rb",
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
41
41
  "lib/hypertable/gen-rb/hql_types.rb",
42
42
  "lib/hypertable/thrift_client.rb",
43
43
  "lib/hypertable/thrift_transport_monkey_patch.rb",
44
+ "pkg/hyper_record-0.9.3.gem",
44
45
  "spec/fixtures/pages.yml",
45
46
  "spec/fixtures/qualified_pages.yml",
46
47
  "spec/lib/associations_spec.rb",
@@ -56,9 +57,9 @@ Gem::Specification.new do |s|
56
57
  s.rubygems_version = %q{1.3.6}
57
58
  s.summary = %q{Fully integrates ActiveRecord with Hypertable.}
58
59
  s.test_files = [
59
- "spec/lib/hypertable_adapter_spec.rb",
60
+ "spec/lib/associations_spec.rb",
61
+ "spec/lib/hypertable_adapter_spec.rb",
60
62
  "spec/lib/hyper_record_spec.rb",
61
- "spec/lib/associations_spec.rb",
62
63
  "spec/spec_helper.rb",
63
64
  "test/thrift_client_test.rb",
64
65
  "test/test_helper.rb"
@@ -54,6 +54,7 @@ module ActiveRecord
54
54
  config[:host] ||= 'localhost'
55
55
  config[:port] ||= 38088
56
56
  config[:timeout] ||= 20000
57
+ config[:namespace] ||= '/'
57
58
 
58
59
  connection = Hypertable::ThriftClient.new(config[:host], config[:port],
59
60
  config[:timeout])
@@ -79,6 +80,9 @@ module ActiveRecord
79
80
  super(connection, logger)
80
81
  @config = config
81
82
  @hypertable_column_names = {}
83
+ if connection
84
+ @namespace = connection.open_namespace(@config[:namespace])
85
+ end
82
86
  end
83
87
 
84
88
  def raw_thrift_client(&block)
@@ -134,9 +138,11 @@ module ActiveRecord
134
138
 
135
139
  # Execute an HQL query against Hypertable and return the native
136
140
  # HqlResult object that comes back from the Thrift client API.
137
- def execute(hql, name=nil)
138
- log(hql, name) {
139
- retry_on_connection_error { @connection.hql_query(hql) }
141
+ def execute(hql, options={})
142
+ log(hql, options[:name]) {
143
+ retry_on_connection_error {
144
+ @connection.hql_query(@namespace, hql)
145
+ }
140
146
  }
141
147
  end
142
148
 
@@ -158,7 +164,8 @@ module ActiveRecord
158
164
  # ["page_1", "url", "", "http://...", "1237331693147619002"]
159
165
  # ]
160
166
  cells = retry_on_connection_error {
161
- @connection.get_cells_as_arrays(options[:table_name], scan_spec)
167
+ @connection.get_cells_as_arrays(@namespace, options[:table_name],
168
+ scan_spec)
162
169
  }
163
170
 
164
171
  # Capture performance metrics
@@ -307,6 +314,7 @@ module ActiveRecord
307
314
  @retry_on_failure = false
308
315
  @connection.close
309
316
  @connection.open
317
+ @namespace = @connection.open_namespace(@config[:namespace])
310
318
  retry
311
319
  else
312
320
  raise err
@@ -423,7 +431,8 @@ module ActiveRecord
423
431
 
424
432
  def drop_table(table_name, options = {})
425
433
  retry_on_connection_error {
426
- @connection.drop_table(table_name, options[:if_exists] || false)
434
+ @connection.drop_table(@namespace, table_name,
435
+ options[:if_exists] || false)
427
436
  }
428
437
  end
429
438
 
@@ -509,7 +518,7 @@ module ActiveRecord
509
518
  # </Schema>
510
519
  def describe_table(table_name)
511
520
  retry_on_connection_error {
512
- @connection.get_schema(table_name)
521
+ @connection.get_schema_str(@namespace, table_name)
513
522
  }
514
523
  end
515
524
 
@@ -517,7 +526,7 @@ module ActiveRecord
517
526
  # instance.
518
527
  def tables(name=nil)
519
528
  retry_on_connection_error {
520
- @connection.get_tables
529
+ @connection.get_tables(@namespace)
521
530
  }
522
531
  end
523
532
 
@@ -548,7 +557,8 @@ module ActiveRecord
548
557
  mutate_spec.appname = 'hyper_record'
549
558
  mutate_spec.flush_interval = 1000
550
559
  mutate_spec.flags = 2
551
- @connection.put_cells_as_arrays(table_name, mutate_spec, cells)
560
+ @connection.offer_cells_as_arrays(@namespace, table_name,
561
+ mutate_spec, cells)
552
562
  else
553
563
  @connection.set_cells_as_arrays(mutator, cells)
554
564
  end
@@ -598,10 +608,10 @@ module ActiveRecord
598
608
  t1 = Time.now
599
609
 
600
610
  retry_on_connection_error {
601
- @connection.with_mutator(table_name) do |mutator|
611
+ @connection.with_mutator(@namespace, table_name) do |mutator|
602
612
  thrift_cells = cells.map{|c|
603
613
  cell = thrift_cell_from_native_array(c)
604
- cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_CELL
614
+ cell.key.flag = Hypertable::ThriftGen::KeyFlag::DELETE_CELL
605
615
  cell
606
616
  }
607
617
  @connection.set_cells(mutator, thrift_cells)
@@ -618,12 +628,12 @@ module ActiveRecord
618
628
  cell = Hypertable::ThriftGen::Cell.new
619
629
  cell.key = Hypertable::ThriftGen::Key.new
620
630
  cell.key.row = row_key
621
- cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_ROW
631
+ cell.key.flag = Hypertable::ThriftGen::KeyFlag::DELETE_ROW
622
632
  cell
623
633
  end
624
634
 
625
635
  retry_on_connection_error {
626
- @connection.with_mutator(table_name) do |mutator|
636
+ @connection.with_mutator(@namespace, table_name) do |mutator|
627
637
  @connection.set_cells(mutator, cells)
628
638
  end
629
639
  }
@@ -647,7 +657,7 @@ module ActiveRecord
647
657
  # Mutator methods
648
658
 
649
659
  def open_mutator(table_name, flags=0, flush_interval=0)
650
- @connection.open_mutator(table_name, flags, flush_interval)
660
+ @connection.open_mutator(@namespace, table_name, flags, flush_interval)
651
661
  end
652
662
 
653
663
  # Flush is always called in a mutator's destructor due to recent
@@ -665,7 +675,7 @@ module ActiveRecord
665
675
  # Scanner methods
666
676
 
667
677
  def open_scanner(table_name, scan_spec)
668
- @connection.open_scanner(table_name, scan_spec, true)
678
+ @connection.open_scanner(@namespace, table_name, scan_spec, true)
669
679
  end
670
680
 
671
681
  def close_scanner(scanner)
@@ -673,7 +683,7 @@ module ActiveRecord
673
683
  end
674
684
 
675
685
  def with_scanner(table_name, scan_spec, &block)
676
- @connection.with_scanner(table_name, scan_spec, &block)
686
+ @connection.with_scanner(@namespace, table_name, scan_spec, &block)
677
687
  end
678
688
 
679
689
  # Iterator methods