td-client 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/lib/td/client.rb +4 -0
- data/lib/td/client/api.rb +17 -0
- data/lib/td/client/model.rb +4 -0
- data/lib/td/client/version.rb +1 -1
- metadata +4 -4
data/ChangeLog
CHANGED
data/lib/td/client.rb
CHANGED
@@ -99,6 +99,10 @@ class Client
|
|
99
99
|
raise NotFoundError, "Table '#{db_name}.#{table_name}' does not exist"
|
100
100
|
end
|
101
101
|
|
102
|
+
def tail(db_name, table_name, count, to=nil, from=nil)
|
103
|
+
@api.tail(db_name, table_name, count, to, from)
|
104
|
+
end
|
105
|
+
|
102
106
|
# => Job
|
103
107
|
def query(db_name, q)
|
104
108
|
job_id = @api.hive_query(q, db_name)
|
data/lib/td/client/api.rb
CHANGED
@@ -182,6 +182,23 @@ class API
|
|
182
182
|
return type
|
183
183
|
end
|
184
184
|
|
185
|
+
def tail(db, table, count, to, from)
|
186
|
+
params = {'format' => 'msgpack'}
|
187
|
+
params['count'] = count.to_s if count
|
188
|
+
params['to'] = to.to_s if to
|
189
|
+
params['from'] = from.to_s if from
|
190
|
+
code, body, res = get("/v3/table/tail/#{e db}/#{e table}", params)
|
191
|
+
if code != "200"
|
192
|
+
raise_error("Tail table failed", res)
|
193
|
+
end
|
194
|
+
require 'msgpack'
|
195
|
+
result = []
|
196
|
+
MessagePack::Unpacker.new.feed_each(body) {|row|
|
197
|
+
result << row
|
198
|
+
}
|
199
|
+
return result
|
200
|
+
end
|
201
|
+
|
185
202
|
|
186
203
|
####
|
187
204
|
## Job API
|
data/lib/td/client/model.rb
CHANGED
data/lib/td/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 3
|
10
|
+
version: 0.8.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sadayuki Furuhashi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-03 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|