Class: Norikra::Client
- Inherits:
-
Object
show all
- Defined in:
- lib/norikra/client.rb,
lib/norikra/client/cli.rb,
lib/norikra/client/version.rb
Defined Under Namespace
Modules: CLIUtil
Classes: Admin, CLI, Event, Field, Query, Target
Constant Summary
collapse
- RPC_DEFAULT_PORT =
26571
- TIMEOUT_OPTIONS =
[:connect_timeout, :send_timeout, :receive_timeout]
- VERSION =
"1.3.1"
Instance Method Summary
collapse
-
#close(target) ⇒ Object
-
#deregister(query_name) ⇒ Object
-
#event(query_name) ⇒ Object
-
#fields(target) ⇒ Object
-
#initialize(host = 'localhost', port = RPC_DEFAULT_PORT, opts = {}) ⇒ Client
constructor
A new instance of Client.
-
#logs ⇒ Object
-
#modify(target, auto_field) ⇒ Object
-
#open(target, fields = nil, auto_field = true) ⇒ Object
-
#queries ⇒ Object
-
#register(query_name, query_group, query_expression) ⇒ Object
-
#reserve(target, field, type) ⇒ Object
-
#resume(query_name) ⇒ Object
-
#see(query_name) ⇒ Object
-
#send(target, events) ⇒ Object
-
#suspend(query_name) ⇒ Object
-
#sweep(query_group = nil) ⇒ Object
-
#targets ⇒ Object
Constructor Details
#initialize(host = 'localhost', port = RPC_DEFAULT_PORT, opts = {}) ⇒ Client
Returns a new instance of Client.
16
17
18
19
20
21
22
|
# File 'lib/norikra/client.rb', line 16
def initialize(host='localhost', port=RPC_DEFAULT_PORT, opts={})
@client = MessagePack::RPCOverHTTP::Client.new("http://#{host}:#{port}/")
@client.connect_timeout = opts[:connect_timeout] if opts.has_key?(:connect_timeout) && @client.respond_to?('connect_timeout='.to_sym)
@client.send_timeout = opts[:send_timeout] if opts.has_key?(:send_timeout) && @client.respond_to?('send_timeout='.to_sym)
@client.receive_timeout = opts[:receive_timeout] if opts.has_key?(:receive_timeout) && @client.respond_to?('receive_timeout='.to_sym)
end
|
Instance Method Details
#close(target) ⇒ Object
32
33
34
|
# File 'lib/norikra/client.rb', line 32
def close(target)
@client.call(:close, target)
end
|
#deregister(query_name) ⇒ Object
48
49
50
|
# File 'lib/norikra/client.rb', line 48
def deregister(query_name)
@client.call(:deregister, query_name)
end
|
#event(query_name) ⇒ Object
73
74
75
|
# File 'lib/norikra/client.rb', line 73
def event(query_name)
@client.call(:event, query_name)
end
|
#fields(target) ⇒ Object
60
61
62
|
# File 'lib/norikra/client.rb', line 60
def fields(target)
@client.call(:fields, target)
end
|
#logs ⇒ Object
87
88
89
|
# File 'lib/norikra/client.rb', line 87
def logs
@client.call(:logs)
end
|
#modify(target, auto_field) ⇒ Object
36
37
38
|
# File 'lib/norikra/client.rb', line 36
def modify(target, auto_field)
@client.call(:modify, target, auto_field)
end
|
#open(target, fields = nil, auto_field = true) ⇒ Object
28
29
30
|
# File 'lib/norikra/client.rb', line 28
def open(target, fields=nil, auto_field=true)
@client.call(:open, target, fields, auto_field)
end
|
#queries ⇒ Object
40
41
42
|
# File 'lib/norikra/client.rb', line 40
def queries
@client.call(:queries)
end
|
#register(query_name, query_group, query_expression) ⇒ Object
44
45
46
|
# File 'lib/norikra/client.rb', line 44
def register(query_name, query_group, query_expression)
@client.call(:register, query_name, query_group, query_expression)
end
|
#reserve(target, field, type) ⇒ Object
64
65
66
|
# File 'lib/norikra/client.rb', line 64
def reserve(target, field, type)
@client.call(:reserve, target, field, type)
end
|
#resume(query_name) ⇒ Object
56
57
58
|
# File 'lib/norikra/client.rb', line 56
def resume(query_name)
@client.call(:resume, query_name)
end
|
#see(query_name) ⇒ Object
78
79
80
|
# File 'lib/norikra/client.rb', line 78
def see(query_name)
@client.call(:see, query_name)
end
|
#send(target, events) ⇒ Object
68
69
70
|
# File 'lib/norikra/client.rb', line 68
def send(target, events)
@client.call(:send, target, events)
end
|
#suspend(query_name) ⇒ Object
52
53
54
|
# File 'lib/norikra/client.rb', line 52
def suspend(query_name)
@client.call(:suspend, query_name)
end
|
#sweep(query_group = nil) ⇒ Object
83
84
85
|
# File 'lib/norikra/client.rb', line 83
def sweep(query_group=nil)
@client.call(:sweep, query_group)
end
|
#targets ⇒ Object
24
25
26
|
# File 'lib/norikra/client.rb', line 24
def targets
@client.call(:targets) end
|