hbasegate 0.1.1 → 0.2.0
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/lib/hbasegate/htable.rb +16 -1
- data/lib/hbasegate/version.rb +1 -1
- data/lib/hbasegate.rb +1 -0
- metadata +1 -1
data/lib/hbasegate/htable.rb
CHANGED
|
@@ -3,17 +3,19 @@ module HBaseGate
|
|
|
3
3
|
java_import 'org.apache.hadoop.hbase.client.Get'
|
|
4
4
|
java_import 'org.apache.hadoop.hbase.client.HTable'
|
|
5
5
|
java_import 'org.apache.hadoop.hbase.client.Put'
|
|
6
|
+
java_import 'org.apache.hadoop.hbase.client.Scan'
|
|
6
7
|
|
|
7
8
|
class HTable
|
|
8
9
|
alias_method :original_delete, :delete
|
|
9
10
|
alias_method :original_get, :get
|
|
10
11
|
alias_method :original_put, :put
|
|
12
|
+
alias_method :original_get_scanner, :get_scanner
|
|
11
13
|
|
|
12
14
|
# Read row key with an array of family, column arrays.
|
|
13
15
|
def get(key, entries = nil)
|
|
14
16
|
get = Get.new(key.to_java_bytes)
|
|
15
17
|
augment_action(entries, get.method(:add_family), get.method(:add_column))
|
|
16
|
-
original_get(get)
|
|
18
|
+
original_get(get)
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
# Store row key with an array of family, column, value arrays.
|
|
@@ -32,6 +34,19 @@ module HBaseGate
|
|
|
32
34
|
original_delete(delete)
|
|
33
35
|
end
|
|
34
36
|
|
|
37
|
+
# Create a scanner for the table.
|
|
38
|
+
def get_scanner(start_row = nil, stop_row = nil)
|
|
39
|
+
scan = case
|
|
40
|
+
when stop_row
|
|
41
|
+
Scan.new(start_row.to_java_bytes, stop_row.to_java_bytes)
|
|
42
|
+
when start_row
|
|
43
|
+
Scan.new(start_row.to_java_bytes)
|
|
44
|
+
else
|
|
45
|
+
Scan.new
|
|
46
|
+
end
|
|
47
|
+
original_get_scanner(scan)
|
|
48
|
+
end
|
|
49
|
+
|
|
35
50
|
private
|
|
36
51
|
# Iterate over the entries and use the given functions on them.
|
|
37
52
|
def augment_action(entries, family_do, qualifier_do)
|
data/lib/hbasegate/version.rb
CHANGED
data/lib/hbasegate.rb
CHANGED