Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
General refactoring of Bigrecord Driver
- Loading branch information
Showing
17 changed files
with
595 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
LIB_ROOT = File.dirname(__FILE__) | ||
BRD_ROOT = File.dirname(__FILE__) | ||
|
||
require LIB_ROOT + '/big_record_driver/client' | ||
require LIB_ROOT + '/big_record_driver/exceptions' | ||
require LIB_ROOT + '/big_record_driver/column_descriptor' | ||
require LIB_ROOT + '/big_record_driver/driver_manager' | ||
require LIB_ROOT + '/big_record_driver/version' | ||
require BRD_ROOT + '/big_record_driver/client' | ||
require BRD_ROOT + '/big_record_driver/exceptions' | ||
require BRD_ROOT + '/big_record_driver/column_descriptor' | ||
require BRD_ROOT + '/big_record_driver/version' |
119 changes: 0 additions & 119 deletions
119
bigrecord-driver/lib/big_record_driver/bigrecord_server.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
require 'rubygems' | ||
require 'activesupport' | ||
require 'active_support' | ||
require 'set' | ||
require 'drb' | ||
|
||
module BigRecordDriver | ||
class Client | ||
|
||
def initialize(config={}) # :nodoc: | ||
config = config.symbolize_keys | ||
config[:drb_host] ||= '127.0.0.1' | ||
config[:drb_port] ||= 40000 | ||
|
||
@config = config | ||
|
||
DRb.start_service('druby://127.0.0.1:0') | ||
begin | ||
@server = DRbObject.new(nil, "druby://#{@config[:drb_host]}:#{@config[:drb_port]}") | ||
rescue DRb::DRbConnError | ||
raise ConnectionError, "Failed to connect to the DRb server (jruby) " + | ||
"at #{@config[:drb_host]}:#{@config[:drb_port]}." | ||
module BigRecord | ||
module Driver | ||
|
||
class Client | ||
attr_accessor :config, :server | ||
|
||
def initialize(config={}) # :nodoc: | ||
config = config.symbolize_keys | ||
config[:drb_host] ||= '127.0.0.1' | ||
config[:drb_port] ||= 40000 | ||
|
||
@config = config | ||
|
||
DRb.start_service nil | ||
begin | ||
@server = DRbObject.new(nil, "druby://#{@config[:drb_host]}:#{@config[:drb_port]}") | ||
rescue DRb::DRbConnError | ||
raise ConnectionError, "Failed to connect to the DRb server (jruby) " + | ||
"at #{@config[:drb_host]}:#{@config[:drb_port]}." | ||
end | ||
@server.configure(@config) | ||
end | ||
|
||
# Delegate the methods to the server | ||
def method_missing(method, *args) | ||
@server.send(method, *args) | ||
end | ||
|
||
def respond_to?(method) | ||
super | ||
end | ||
@server.configure(@config) | ||
end | ||
|
||
# Delegate the methods to the server | ||
def method_missing(method, *args) | ||
@server.send(method, *args) | ||
end | ||
|
||
def respond_to?(method) | ||
super | ||
end | ||
|
||
end | ||
end |
29 changes: 13 additions & 16 deletions
29
bigrecord-driver/lib/big_record_driver/column_descriptor.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
module BigRecordDriver | ||
module BigRecord | ||
module Driver | ||
|
||
class ColumnDescriptor | ||
class ColumnDescriptor | ||
attr_accessor :name, :versions, :in_memory, :bloom_filter, :compression | ||
|
||
attr_accessor :name | ||
attr_accessor :versions | ||
attr_accessor :in_memory | ||
attr_accessor :bloom_filter | ||
attr_accessor :compression | ||
def initialize(name, options={}) | ||
raise ArgumentError, "name is mandatory" unless name | ||
|
||
def initialize(name, options={}) | ||
raise ArgumentError, "name is mandatory" unless name | ||
|
||
@name = name.to_s | ||
@versions = options[:versions] | ||
@in_memory = options[:in_memory] | ||
@bloom_filter = options[:bloom_filter] | ||
@compression = options[:compression] | ||
@name = name.to_s | ||
@versions = options[:versions] | ||
@in_memory = options[:in_memory] | ||
@bloom_filter = options[:bloom_filter] | ||
@compression = options[:compression] | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
|
Oops, something went wrong.