hbase-stargate 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +2 -2
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/lib/stargate/operation/scanner_operation.rb +5 -0
- data/spec/hbase-stargate/operation/scanner_operation_spec.rb +65 -0
- data/spec/spec_helper.rb +1 -1
- metadata +35 -19
data/README.textile
CHANGED
|
@@ -16,7 +16,7 @@ To work with this gem in your Rails application, add this to the environment.rb
|
|
|
16
16
|
<pre><code>config.gem 'hbase-stargate', :lib => "stargate", :source => "http://gemcutter.org"</code></pre>
|
|
17
17
|
|
|
18
18
|
To build the gem yourself:
|
|
19
|
-
<pre><code>$ rake
|
|
19
|
+
<pre><code>$ rake build</code></pre>
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
h2. Getting Started
|
|
@@ -75,5 +75,5 @@ $ rake spec STARGATE_URL=http://localhost:8080
|
|
|
75
75
|
|
|
76
76
|
h2. Copyright
|
|
77
77
|
|
|
78
|
-
Copyright (c) 2008
|
|
78
|
+
Copyright (c) 2008 Openplaces.org
|
|
79
79
|
Distributed under MIT License
|
data/Rakefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'rspec/core/rake_task'
|
|
2
2
|
|
|
3
3
|
begin
|
|
4
4
|
require 'jeweler'
|
|
@@ -20,7 +20,7 @@ rescue LoadError
|
|
|
20
20
|
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
t.
|
|
25
|
-
t.
|
|
23
|
+
RSpec::Core::RakeTask.new do |t|
|
|
24
|
+
t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
|
|
25
|
+
t.pattern = 'spec/**/*_spec.rb'
|
|
26
26
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.5.
|
|
1
|
+
1.5.2
|
|
@@ -12,11 +12,16 @@ module Stargate
|
|
|
12
12
|
raise ArgumentError, "options should be given as a Hash" unless options.instance_of? Hash
|
|
13
13
|
columns = options.delete(:columns)
|
|
14
14
|
batch = options.delete(:batch) || "10"
|
|
15
|
+
start_time = options.delete(:start_time)
|
|
16
|
+
end_time = options.delete(:end_time)
|
|
15
17
|
|
|
16
18
|
begin
|
|
17
19
|
request = Request::ScannerRequest.new(table_name)
|
|
18
20
|
|
|
19
21
|
xml_data = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><Scanner batch='#{batch}' "
|
|
22
|
+
xml_data += "startTime='#{start_time}' " if start_time
|
|
23
|
+
xml_data += "endTime='#{end_time}' " if end_time
|
|
24
|
+
|
|
20
25
|
options.each do |key,value|
|
|
21
26
|
if Model::Scanner::AVAILABLE_OPTS.include? key
|
|
22
27
|
xml_data << "#{Model::Scanner::AVAILABLE_OPTS[key]}='#{[value.to_s].flatten.pack('m')}' "
|
|
@@ -10,6 +10,22 @@ describe Stargate::Operation::ScannerOperation do
|
|
|
10
10
|
@client.create_row('test-hbase-stargate', 'row1', nil, {:name => 'col1:', :value => "row1-col1"})
|
|
11
11
|
@client.create_row('test-hbase-stargate', 'row2', nil, {:name => 'col1:', :value => "row2-col1"})
|
|
12
12
|
@client.create_row('test-hbase-stargate', 'row3', nil, {:name => 'col1:', :value => "row3-col1"})
|
|
13
|
+
|
|
14
|
+
scan_table = @client.create_table("test-hbase-stargate-scan", "col1")
|
|
15
|
+
|
|
16
|
+
@ts1 = (Time.now - (5*60)).to_i
|
|
17
|
+
@client.create_row("test-hbase-stargate-scan", "rowts11", @ts1, { :name => "col1:", :value => "rowts11-col1-cell1" }).should be_true
|
|
18
|
+
@client.create_row("test-hbase-stargate-scan", "rowts12", @ts1, { :name => "col1:", :value => "rowts12-col1-cell1" }).should be_true
|
|
19
|
+
|
|
20
|
+
@ts2 = (Time.now - (5*60)).to_i + 1000
|
|
21
|
+
@client.create_row("test-hbase-stargate-scan", "rowts21", @ts2, { :name => "col1:", :value => "rowts21-col1-cell1" }).should be_true
|
|
22
|
+
@client.create_row("test-hbase-stargate-scan", "rowts22", @ts2, { :name => "col1:", :value => "rowts22-col1-cell1" }).should be_true
|
|
23
|
+
|
|
24
|
+
@ts3 = (Time.now - (5*60)).to_i + 2000
|
|
25
|
+
@client.create_row("test-hbase-stargate-scan", "rowts31", @ts3, { :name => "col1:", :value => "rowts31-col1-cell1" }).should be_true
|
|
26
|
+
@client.create_row("test-hbase-stargate-scan", "rowts32", @ts3, { :name => "col1:", :value => "rowts32-col1-cell1" }).should be_true
|
|
27
|
+
|
|
28
|
+
@ts4 = (Time.now - (5*60)).to_i + 3000
|
|
13
29
|
end
|
|
14
30
|
|
|
15
31
|
it "should throw TableNotFoundError if a scanner is requested for an non-existant table" do
|
|
@@ -97,7 +113,56 @@ describe Stargate::Operation::ScannerOperation do
|
|
|
97
113
|
@client.close_scanner(scanner).should be_true
|
|
98
114
|
end
|
|
99
115
|
|
|
116
|
+
it "should scan all 6 rows when given first timestamp" do
|
|
117
|
+
scanner = @client.open_scanner("test-hbase-stargate-scan", {:start_time => @ts1})
|
|
118
|
+
rows = @client.get_rows(scanner)
|
|
119
|
+
rows.size.should == 6
|
|
120
|
+
rows.each do |row|
|
|
121
|
+
row.should be_an_instance_of Stargate::Model::Row
|
|
122
|
+
["rowts11","rowts12","rowts21","rowts22","rowts31","rowts32"].should include(row.name)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
@client.close_scanner(scanner).should be_true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it "should scan last 2 rows when given last timestamp as start" do
|
|
129
|
+
scanner = @client.open_scanner("test-hbase-stargate-scan", {:start_time => @ts3})
|
|
130
|
+
rows = @client.get_rows(scanner)
|
|
131
|
+
rows.size.should == 2
|
|
132
|
+
rows.each do |row|
|
|
133
|
+
row.should be_an_instance_of Stargate::Model::Row
|
|
134
|
+
["rowts31","rowts32"].should include(row.name)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
@client.close_scanner(scanner).should be_true
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it "should scan first 4 rows when given middle timestamp as end" do
|
|
141
|
+
scanner = @client.open_scanner("test-hbase-stargate-scan", {:start_time => @ts1, :end_time => @ts3})
|
|
142
|
+
rows = @client.get_rows(scanner)
|
|
143
|
+
rows.size.should == 4
|
|
144
|
+
rows.each do |row|
|
|
145
|
+
row.should be_an_instance_of Stargate::Model::Row
|
|
146
|
+
["rowts11","rowts12","rowts21","rowts22"].should include(row.name)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
@client.close_scanner(scanner).should be_true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it "should scan last 4 rows when given start and end timestamp" do
|
|
153
|
+
scanner = @client.open_scanner("test-hbase-stargate-scan", {:start_time => @ts2, :end_time => @ts4})
|
|
154
|
+
rows = @client.get_rows(scanner)
|
|
155
|
+
rows.size.should == 4
|
|
156
|
+
rows.each do |row|
|
|
157
|
+
row.should be_an_instance_of Stargate::Model::Row
|
|
158
|
+
["rowts21","rowts22","rowts31","rowts32"].should include(row.name)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
@client.close_scanner(scanner).should be_true
|
|
162
|
+
end
|
|
163
|
+
|
|
100
164
|
after :all do
|
|
101
165
|
@client.destroy_table("test-hbase-stargate")
|
|
166
|
+
@client.destroy_table("test-hbase-stargate-scan")
|
|
102
167
|
end
|
|
103
168
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hbase-stargate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 7
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 1
|
|
8
|
+
- 5
|
|
9
|
+
- 2
|
|
10
|
+
version: 1.5.2
|
|
5
11
|
platform: ruby
|
|
6
12
|
authors:
|
|
7
13
|
- Openplaces
|
|
@@ -9,19 +15,23 @@ autorequire:
|
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
17
|
|
|
12
|
-
date: 2010-
|
|
18
|
+
date: 2010-12-26 00:00:00 -05:00
|
|
13
19
|
default_executable:
|
|
14
20
|
dependencies:
|
|
15
21
|
- !ruby/object:Gem::Dependency
|
|
16
22
|
name: rspec
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
20
26
|
requirements:
|
|
21
27
|
- - ">="
|
|
22
28
|
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 3
|
|
30
|
+
segments:
|
|
31
|
+
- 0
|
|
23
32
|
version: "0"
|
|
24
|
-
|
|
33
|
+
type: :development
|
|
34
|
+
version_requirements: *id001
|
|
25
35
|
description: A Ruby client used to interact with HBase through its Stargate web service front-end
|
|
26
36
|
email: greg.lu@gmail.com
|
|
27
37
|
executables: []
|
|
@@ -93,42 +103,48 @@ rdoc_options:
|
|
|
93
103
|
require_paths:
|
|
94
104
|
- lib
|
|
95
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
|
+
none: false
|
|
96
107
|
requirements:
|
|
97
108
|
- - ">="
|
|
98
109
|
- !ruby/object:Gem::Version
|
|
110
|
+
hash: 3
|
|
111
|
+
segments:
|
|
112
|
+
- 0
|
|
99
113
|
version: "0"
|
|
100
|
-
version:
|
|
101
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
|
+
none: false
|
|
102
116
|
requirements:
|
|
103
117
|
- - ">="
|
|
104
118
|
- !ruby/object:Gem::Version
|
|
119
|
+
hash: 3
|
|
120
|
+
segments:
|
|
121
|
+
- 0
|
|
105
122
|
version: "0"
|
|
106
|
-
version:
|
|
107
123
|
requirements: []
|
|
108
124
|
|
|
109
125
|
rubyforge_project:
|
|
110
|
-
rubygems_version: 1.3.
|
|
126
|
+
rubygems_version: 1.3.7
|
|
111
127
|
signing_key:
|
|
112
128
|
specification_version: 3
|
|
113
129
|
summary: Ruby client for HBase's Stargate web service
|
|
114
130
|
test_files:
|
|
115
|
-
- spec/hbase-stargate/request/row_request_spec.rb
|
|
116
|
-
- spec/hbase-stargate/request/table_request_spec.rb
|
|
117
|
-
- spec/hbase-stargate/request/meta_request_spec.rb
|
|
118
|
-
- spec/hbase-stargate/request/scanner_request_spec.rb
|
|
119
|
-
- spec/hbase-stargate/model/scanner.rb
|
|
120
|
-
- spec/hbase-stargate/model/column_spec.rb
|
|
121
|
-
- spec/hbase-stargate/model/row_spec.rb
|
|
122
131
|
- spec/hbase-stargate/model/column_descriptor_spec.rb
|
|
132
|
+
- spec/hbase-stargate/model/column_spec.rb
|
|
123
133
|
- spec/hbase-stargate/model/region_descriptor_spec.rb
|
|
134
|
+
- spec/hbase-stargate/model/row_spec.rb
|
|
135
|
+
- spec/hbase-stargate/model/scanner.rb
|
|
124
136
|
- spec/hbase-stargate/model/table_descriptor_spec.rb
|
|
125
|
-
- spec/hbase-stargate/operation/row_operation_spec.rb
|
|
126
137
|
- spec/hbase-stargate/operation/meta_operation_spec.rb
|
|
138
|
+
- spec/hbase-stargate/operation/row_operation_spec.rb
|
|
127
139
|
- spec/hbase-stargate/operation/scanner_operation_spec.rb
|
|
128
140
|
- spec/hbase-stargate/operation/table_operation_spec.rb
|
|
129
141
|
- spec/hbase-stargate/record_spec.rb
|
|
130
|
-
- spec/hbase-stargate/
|
|
142
|
+
- spec/hbase-stargate/request/meta_request_spec.rb
|
|
143
|
+
- spec/hbase-stargate/request/row_request_spec.rb
|
|
144
|
+
- spec/hbase-stargate/request/scanner_request_spec.rb
|
|
145
|
+
- spec/hbase-stargate/request/table_request_spec.rb
|
|
131
146
|
- spec/hbase-stargate/response/meta_response_spec.rb
|
|
132
|
-
- spec/hbase-stargate/response/table_response_spec.rb
|
|
133
147
|
- spec/hbase-stargate/response/row_response_spec.rb
|
|
148
|
+
- spec/hbase-stargate/response/scanner_response_spec.rb
|
|
149
|
+
- spec/hbase-stargate/response/table_response_spec.rb
|
|
134
150
|
- spec/spec_helper.rb
|