X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2FMCollective%2FClient.html;fp=doc%2Fclasses%2FMCollective%2FClient.html;h=3356cd4b145fd62e588057acd2b5a07c867ae9af;hb=7c9314f502cde8daad23b61d10b24a542e04154a;hp=14106d0fdee471be4b2fcea65ae7bedcbaf98b78;hpb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Client.html b/doc/MCollective/Client.html similarity index 57% rename from doc/classes/MCollective/Client.html rename to doc/MCollective/Client.html index 14106d0..3356cd4 100644 --- a/doc/classes/MCollective/Client.html +++ b/doc/MCollective/Client.html @@ -1,172 +1,457 @@ - - - + + - Class: MCollective::Client - - - - - - - - - + -
- - - - - - - - - + Class: MCollective::Client - - - - -
ClassMCollective::Client
In: - - lib/mcollective/client.rb - -
-
Parent: - Object -
-
- + -
+ + + + - - -
- -
-

+ + + +

+
+
+

In Files

+ +
+ + +
+ +
+ + + +
+

Parent

+ + + +
+ + + + + + + + + + + + +
+ +
+ + + + + +
+

Class Index + [+]

+
+
+ Quicksearch + +
+
+ + + +
+ + +
+
+ +
+

MCollective::Client

+ +
+

Helpers for writing clients that can talk to agents, do discovery and so forth

-
- - -
- -
-

Methods

- -
- collective   - createreq   - disconnect   - discover   - discovered_req   - display_stats   - new   - receive   - req   - sendreq   - start_publisher   - start_receiver   - subscribe   - threaded_req   - unsubscribe   - unthreaded_req   - update_stat   -
-
- -
- - - - -
- - - - - -
-

Attributes

- -
- - - - - - - - - - - - - - - - -
discoverer [RW] 
options [RW] 
stats [RW] 
-
-
- - - - -
-

Public Class methods

- -
- - - - -
-

[Source]

-
+
+ + + + + + +
+

Attributes

+ + +
+ + + + +
+ options[RW] +
+ +
+ +

(Not documented)

+ +
+
+ +
+ + + + +
+ stats[RW] +
+ +
+ +

(Not documented)

+ +
+
+ +
+ + + + +
+ discoverer[RW] +
+ +
+ +

(Not documented)

+ +
+
+ +
+ + + + +
+

Public Class Methods

+ + +
+ + +
+ + new(configfile) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
     # File lib/mcollective/client.rb, line 6
  6:     def initialize(configfile)
@@ -182,32 +467,43 @@ forth
 16: 
 17:       @discoverer = Discovery.new(self)
 18:       @connection.connect
-19:     end
-
-
-
-
- -

Public Instance methods

- -
- - - - -
-

-Returns the configured main collective if -no specific collective is specified as -options +19: end +

+ +
+ + +
+ + +
+ +
+

Public Instance Methods

+ + +
+ + +
+ + collective() + click to toggle source + +
+ +
+ +

+Returns the configured main collective if no specific collective is +specified as options

-

[Source]

-
+ + + +
     # File lib/mcollective/client.rb, line 23
 23:     def collective
@@ -216,25 +512,34 @@ options
 26:       else
 27:         @options[:collective]
 28:       end
-29:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+29: end +
+ +
+ + +
+ + +
+ + +
+ + createreq(msg, agent, filter ={}) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
     # File lib/mcollective/client.rb, line 48
 48:     def createreq(msg, agent, filter ={})
@@ -250,50 +555,64 @@ options
 58:       request.encode!
 59:       subscribe(agent, :reply) unless request.reply_to
 60:       request
-61:     end
-
-
-
-
- -
- - - - -
-

+61: end +

+ +
+ + +
+ + +
+ + +
+ + disconnect() + click to toggle source + +
+ +
+ +

Disconnects cleanly from the middleware

-

[Source]

-
+ + + +
     # File lib/mcollective/client.rb, line 32
 32:     def disconnect
 33:       Log.debug("Disconnecting from the middleware")
 34:       @connection.disconnect
-35:     end
-
-
-
-
- -
- - - - -
-

+35: end +

+ +
+ + +
+ + +
+ + +
+ + discover(filter, timeout, limit=0) + click to toggle source + +
+ +
+ +

Performs a discovery of nodes matching the filter passed returns an array of nodes

@@ -301,59 +620,78 @@ of nodes An integer limit can be supplied this will have the effect of the discovery being cancelled soon as it reached the requested limit of hosts

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 117
 117:     def discover(filter, timeout, limit=0)
 118:       discovered = @discoverer.discover(filter, timeout, limit)
-119:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+119: end +
+ +
+ + +
+ + +
+ + +
+ + discovered_req(body, agent, options=false) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/client.rb, line 233
 233:     def discovered_req(body, agent, options=false)
 234:       raise "Client#discovered_req has been removed, please port your agent and client to the SimpleRPC framework"
-235:     end
-
-
-
-
- -
- - - - -
-

-Prints out the stats returns from req and -discovered_req in a nice way +235: end +

+ +
+ + +
+ + +
+ + +
+ + display_stats(stats, options=false, caption="stomp call summary") + click to toggle source + +
+ +
+ +

+Prints out the stats returns from req and discovered_req in a nice way

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 238
 238:     def display_stats(stats, options=false, caption="stomp call summary")
@@ -391,34 +729,42 @@ Prints out the stats returns from req and
 270: 
 271:         puts
 272:       end
-273:     end
-
-
-
-
- -
- - - - -
-

+273: end +

+ +
+ + +
+ + +
+ + +
+ + receive(requestid = nil) + click to toggle source + +
+ +
+ +

Blocking call that waits for ever for a message to arrive.

-If you give it a requestid this means you‘ve previously send a +If you give it a requestid this means you’ve previously send a request with that ID and now you just want replies that matches that id, in that case the current connection will just ignore all messages not directed at it and keep waiting for more till it finds a matching message.

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 88
  88:     def receive(requestid = nil)
@@ -442,28 +788,34 @@ at it and keep waiting for more till it finds a matching message.
 106:       end
 107: 
 108:       reply
-109:     end
-
-
-
-
- - + + +
+ + +
+ + +
+ + req(body, agent=nil, options=false, waitfor=0, &block) + click to toggle source + +
+ +
+ +

Send a request, performs the passed block for each response

-times = req("status", -"mcollectived", options, client) {|resp| +times = req(“status”, “mcollectived”, options, +client) {|resp|

   pp resp
@@ -476,9 +828,11 @@ It returns a hash of times and timeouts for discovery and total run is
 taken from the options hash which in turn is generally built using MCollective::Optionparser
 

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 129
 129:     def req(body, agent=nil, options=false, waitfor=0, &block)
@@ -510,30 +864,38 @@ href="Optionparser.html">MCollective::Optionparser
 155:       end
 156: 
 157:       return update_stat(stat, hosts_responded, request.requestid)
-158:     end
-
-
-
-
- -
- - - - -
-

-Sends a request and returns the generated request id, doesn‘t wait -for responses and doesn‘t execute any passed in code blocks for +158: end +

+ +
+ + +
+ + +
+ + +
+ + sendreq(msg, agent, filter = {}) + click to toggle source + +
+ +
+ +

+Sends a request and returns the generated request id, doesn’t wait +for responses and doesn’t execute any passed in code blocks for responses

-

[Source]

-
+ + + +
     # File lib/mcollective/client.rb, line 39
 39:     def sendreq(msg, agent, filter = {})
@@ -543,28 +905,36 @@ responses
 43: 
 44:       request.publish
 45:       request.requestid
-46:     end
-
-
-
-
- - + + +
+ + +
+ + +
+ + start_publisher(request, publish_timeout) + click to toggle source + +
+ +
+ +

Starts the request publishing routine

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 191
 191:     def start_publisher(request, publish_timeout)
@@ -577,29 +947,37 @@ Starts the request publishing routine
 198:       rescue Timeout::Error => e
 199:         Log.warn("Could not publish all messages. Publishing timed out.")
 200:       end
-201:     end
-
-
-
-
- - + + +
+ + +
+ + +
+ + start_receiver(requestid, waitfor, timeout, &block) + click to toggle source + +
+ +
+ +

Starts the response receiver routine Expected to return the amount of received responses.

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 205
 205:     def start_receiver(requestid, waitfor, timeout, &block)
@@ -618,25 +996,34 @@ received responses.
 218:       end
 219: 
 220:       hosts_responded
-221:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+221: end +
+ +
+ + +
+ + +
+ + +
+ + subscribe(agent, type) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
     # File lib/mcollective/client.rb, line 63
 63:     def subscribe(agent, type)
@@ -647,29 +1034,37 @@ received responses.
 68:         Util.subscribe(subscription)
 69:         @subscriptions[agent] = 1
 70:       end
-71:     end
-
-
-
-
- - + + +
+ + +
+ + +
+ + threaded_req(request, publish_timeout, timeout, waitfor, &block) + click to toggle source + +
+ +
+ +

Starts the client receiver and publisher in threads. This is activated when the ‘threader_client’ configuration option is set.

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 170
 170:     def threaded_req(request, publish_timeout, timeout, waitfor, &block)
@@ -690,25 +1085,34 @@ the ‘threader_client’ configuration option is set.
 185: 
 186:       receiver.join
 187:       hosts_responded
-188:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+188: end +
+ +
+ + +
+ + +
+ + +
+ + unsubscribe(agent, type) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
     # File lib/mcollective/client.rb, line 73
 73:     def unsubscribe(agent, type)
@@ -719,53 +1123,70 @@ the ‘threader_client’ configuration option is set.
 78:         Util.unsubscribe(subscription)
 79:         @subscriptions.delete(agent)
 80:       end
-81:     end
-
-
-
-
- - + + +
+ + +
+ + +
+ + unthreaded_req(request, publish_timeout, timeout, waitfor, &block) + click to toggle source + +
+ +
+ +

Starts the client receiver and publisher unthreaded. This is the default client behaviour.

-

[Source]

-
+ + + +
      # File lib/mcollective/client.rb, line 162
 162:     def unthreaded_req(request, publish_timeout, timeout, waitfor, &block)
 163:       start_publisher(request, publish_timeout)
 164:       start_receiver(request.requestid, waitfor, timeout, &block)
-165:     end
-
-
-
-
- -
- - - - -
-

[Source]

-
+165: end +
+ +
+ + +
+ + +
+ + +
+ + update_stat(stat, hosts_responded, requestid) + click to toggle source + +
+ +
+ +

(Not documented)

+ + + +
      # File lib/mcollective/client.rb, line 223
 223:     def update_stat(stat, hosts_responded, requestid)
@@ -776,22 +1197,33 @@ client behaviour.
 228:       stat[:requestid] = requestid
 229: 
 230:       @stats = stat
-231:     end
-
-
-
-
+231: end +
+ +
+ +
-
+ +
+ +
-
+
+ +

Disabled; run with --debug to generate this.

+ +
-
-

[Validate]

-
+
+

[Validate]

+

Generated with the Darkfish + Rdoc Generator 1.1.6.

+
- \ No newline at end of file + +