Permalink
Browse files

hypertable 0.9.4.0 compatibility, not compatible with previous hypert…

…able releases due to API changes
  • Loading branch information...
1 parent ddd4060 commit b5704484fb7b5c9176368c22b92f271b1099b9f2 @tylerkovacs committed Oct 27, 2010
View
@@ -1,4 +1,9 @@
-0.9.3.4 (not yet released)
+0.9.4.0 (2010/10/27)
+- now compatible with Hypertable 0.9.4.0
+ - note: not backwards compatible with previous Hypertable releases due
+ to API changes
+
+0.9.3.4 (no official release)
- now compatible with Thrift 0.3.0 and Hypertable 0.9.3.4
- note: not backwards compatible with previous Thrift or Hypertable releases
View
@@ -1,4 +1,4 @@
---
:major: 0
:minor: 9
-:patch: 3
+:patch: 4
View
Binary file not shown.
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{hyper_record}
- s.version = "0.9.3"
+ s.version = "0.9.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["tylerkovacs"]
- s.date = %q{2010-05-30}
+ s.date = %q{2010-10-27}
s.description = %q{See README}
s.email = %q{tyler.kovacs@gmail.com}
s.extra_rdoc_files = [
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
s.files = [
".gitignore",
"CHANGELOG",
+ "HOW_TO_RUN_TESTS",
"LICENSE",
"README",
- "HOW_TO_RUN_TESTS",
"Rakefile",
"VERSION.yml",
"benchmark/save.rb",
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
"lib/hypertable/gen-rb/hql_types.rb",
"lib/hypertable/thrift_client.rb",
"lib/hypertable/thrift_transport_monkey_patch.rb",
+ "pkg/hyper_record-0.9.3.gem",
"spec/fixtures/pages.yml",
"spec/fixtures/qualified_pages.yml",
"spec/lib/associations_spec.rb",
@@ -56,9 +57,9 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.6}
s.summary = %q{Fully integrates ActiveRecord with Hypertable.}
s.test_files = [
- "spec/lib/hypertable_adapter_spec.rb",
+ "spec/lib/associations_spec.rb",
+ "spec/lib/hypertable_adapter_spec.rb",
"spec/lib/hyper_record_spec.rb",
- "spec/lib/associations_spec.rb",
"spec/spec_helper.rb",
"test/thrift_client_test.rb",
"test/test_helper.rb"
@@ -54,6 +54,7 @@ def self.hypertable_connection(config)
config[:host] ||= 'localhost'
config[:port] ||= 38088
config[:timeout] ||= 20000
+ config[:namespace] ||= '/'
connection = Hypertable::ThriftClient.new(config[:host], config[:port],
config[:timeout])
@@ -79,6 +80,9 @@ def initialize(connection, logger, config)
super(connection, logger)
@config = config
@hypertable_column_names = {}
+ if connection
+ @namespace = connection.open_namespace(@config[:namespace])
+ end
end
def raw_thrift_client(&block)
@@ -134,9 +138,11 @@ def sanitize_conditions(options)
# Execute an HQL query against Hypertable and return the native
# HqlResult object that comes back from the Thrift client API.
- def execute(hql, name=nil)
- log(hql, name) {
- retry_on_connection_error { @connection.hql_query(hql) }
+ def execute(hql, options={})
+ log(hql, options[:name]) {
+ retry_on_connection_error {
+ @connection.hql_query(@namespace, hql)
+ }
}
end
@@ -158,7 +164,8 @@ def execute_with_options(options)
# ["page_1", "url", "", "http://...", "1237331693147619002"]
# ]
cells = retry_on_connection_error {
- @connection.get_cells_as_arrays(options[:table_name], scan_spec)
+ @connection.get_cells_as_arrays(@namespace, options[:table_name],
+ scan_spec)
}
# Capture performance metrics
@@ -307,6 +314,7 @@ def retry_on_connection_error
@retry_on_failure = false
@connection.close
@connection.open
+ @namespace = @connection.open_namespace(@config[:namespace])
retry
else
raise err
@@ -423,7 +431,8 @@ def create_table(table_name, options={}, &block)
def drop_table(table_name, options = {})
retry_on_connection_error {
- @connection.drop_table(table_name, options[:if_exists] || false)
+ @connection.drop_table(@namespace, table_name,
+ options[:if_exists] || false)
}
end
@@ -509,15 +518,15 @@ def hypertable_column_name(name, table_name, declared_columns_only=false)
# </Schema>
def describe_table(table_name)
retry_on_connection_error {
- @connection.get_schema_str(table_name)
+ @connection.get_schema_str(@namespace, table_name)
}
end
# Returns an array of tables available in the current Hypertable
# instance.
def tables(name=nil)
retry_on_connection_error {
- @connection.get_tables
+ @connection.get_tables(@namespace)
}
end
@@ -548,7 +557,8 @@ def write_cells(table_name, cells, options={})
mutate_spec.appname = 'hyper_record'
mutate_spec.flush_interval = 1000
mutate_spec.flags = 2
- @connection.put_cells_as_arrays(table_name, mutate_spec, cells)
+ @connection.offer_cells_as_arrays(@namespace, table_name,
+ mutate_spec, cells)
else
@connection.set_cells_as_arrays(mutator, cells)
end
@@ -598,10 +608,10 @@ def delete_cells(table_name, cells)
t1 = Time.now
retry_on_connection_error {
- @connection.with_mutator(table_name) do |mutator|
+ @connection.with_mutator(@namespace, table_name) do |mutator|
thrift_cells = cells.map{|c|
cell = thrift_cell_from_native_array(c)
- cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_CELL
+ cell.key.flag = Hypertable::ThriftGen::KeyFlag::DELETE_CELL
cell
}
@connection.set_cells(mutator, thrift_cells)
@@ -618,12 +628,12 @@ def delete_rows(table_name, row_keys)
cell = Hypertable::ThriftGen::Cell.new
cell.key = Hypertable::ThriftGen::Key.new
cell.key.row = row_key
- cell.key.flag = Hypertable::ThriftGen::CellFlag::DELETE_ROW
+ cell.key.flag = Hypertable::ThriftGen::KeyFlag::DELETE_ROW
cell
end
retry_on_connection_error {
- @connection.with_mutator(table_name) do |mutator|
+ @connection.with_mutator(@namespace, table_name) do |mutator|
@connection.set_cells(mutator, cells)
end
}
@@ -647,7 +657,7 @@ def insert_fixture(fixture, table_name)
# Mutator methods
def open_mutator(table_name, flags=0, flush_interval=0)
- @connection.open_mutator(table_name, flags, flush_interval)
+ @connection.open_mutator(@namespace, table_name, flags, flush_interval)
end
# Flush is always called in a mutator's destructor due to recent
@@ -665,15 +675,15 @@ def flush_mutator(mutator)
# Scanner methods
def open_scanner(table_name, scan_spec)
- @connection.open_scanner(table_name, scan_spec, true)
+ @connection.open_scanner(@namespace, table_name, scan_spec, true)
end
def close_scanner(scanner)
@connection.close_scanner(scanner)
end
def with_scanner(table_name, scan_spec, &block)
- @connection.with_scanner(table_name, scan_spec, &block)
+ @connection.with_scanner(@namespace, table_name, scan_spec, &block)
end
# Iterator methods
Oops, something went wrong.

0 comments on commit b570448

Please sign in to comment.