Class: Norikra::Client

Inherits:
Object
  • 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
VERSION =
"1.5.0"

Instance Method Summary collapse

Constructor Details

#initialize(host = 'localhost', port = RPC_DEFAULT_PORT, connect_timeout: nil, send_timeout: nil, receive_timeout: nil) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
21
# File 'lib/norikra/client.rb', line 15

def initialize(host='localhost', port=RPC_DEFAULT_PORT, connect_timeout: nil, send_timeout: nil, receive_timeout: nil)
  @client = MessagePack::RPCOverHTTP::Client.new("http://#{host}:#{port}/")

  @client.connect_timeout = connect_timeout if connect_timeout
  @client.send_timeout = send_timeout if send_timeout
  @client.receive_timeout = receive_timeout if receive_timeout
end

Instance Method Details

#close(target) ⇒ Object



31
32
33
# File 'lib/norikra/client.rb', line 31

def close(target)
  @client.call(:close, target)
end

#deregister(query_name) ⇒ Object



47
48
49
# File 'lib/norikra/client.rb', line 47

def deregister(query_name)
  @client.call(:deregister, query_name)
end

#event(query_name) ⇒ Object

[time, event], …


72
73
74
# File 'lib/norikra/client.rb', line 72

def event(query_name)
  @client.call(:event, query_name)
end

#fields(target) ⇒ Object



59
60
61
# File 'lib/norikra/client.rb', line 59

def fields(target)
  @client.call(:fields, target)
end

#logsObject



86
87
88
# File 'lib/norikra/client.rb', line 86

def logs
  @client.call(:logs)
end

#modify(target, auto_field) ⇒ Object



35
36
37
# File 'lib/norikra/client.rb', line 35

def modify(target, auto_field)
  @client.call(:modify, target, auto_field)
end

#open(target, fields = nil, auto_field = true) ⇒ Object



27
28
29
# File 'lib/norikra/client.rb', line 27

def open(target, fields=nil, auto_field=true)
  @client.call(:open, target, fields, auto_field)
end

#queriesObject



39
40
41
# File 'lib/norikra/client.rb', line 39

def queries
  @client.call(:queries)
end

#register(query_name, query_group, query_expression) ⇒ Object



43
44
45
# File 'lib/norikra/client.rb', line 43

def register(query_name, query_group, query_expression)
  @client.call(:register, query_name, query_group, query_expression)
end

#reserve(target, field, type) ⇒ Object



63
64
65
# File 'lib/norikra/client.rb', line 63

def reserve(target, field, type)
  @client.call(:reserve, target, field, type)
end

#resume(query_name) ⇒ Object



55
56
57
# File 'lib/norikra/client.rb', line 55

def resume(query_name)
  @client.call(:resume, query_name)
end

#see(query_name) ⇒ Object

[time, event], …


77
78
79
# File 'lib/norikra/client.rb', line 77

def see(query_name)
  @client.call(:see, query_name)
end

#send(target, events) ⇒ Object



67
68
69
# File 'lib/norikra/client.rb', line 67

def send(target, events)
  @client.call(:send, target, events)
end

#suspend(query_name) ⇒ Object



51
52
53
# File 'lib/norikra/client.rb', line 51

def suspend(query_name)
  @client.call(:suspend, query_name)
end

#sweep(query_group = nil) ⇒ Object

=> [ [time, event], … ]



82
83
84
# File 'lib/norikra/client.rb', line 82

def sweep(query_group=nil)
  @client.call(:sweep, query_group)
end

#targetsObject



23
24
25
# File 'lib/norikra/client.rb', line 23

def targets
  @client.call(:targets) #=> {:name => "name", :auto_field => true}
end