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=refs%2Fheads%2Fhavana;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 | -
In: | -
-
- lib/mcollective/client.rb
-
- - |
-
Parent: | -- Object - | -
+ +
+ +Helpers for writing clients that can talk to agents, do discovery and so forth
-discoverer | -[RW] | -- |
options | -[RW] | -- |
stats | -[RW] | -- |
(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 --
-Returns the configured main collective if -no specific collective is specified as -options +19: end +
+Returns the configured main collective if no specific collective is +specified as options
- -# File lib/mcollective/client.rb, line 23 23: def collective @@ -216,25 +512,34 @@ options 26: else 27: @options[:collective] 28: end -29: end --
(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 --
Disconnects cleanly from the middleware
- -# File lib/mcollective/client.rb, line 32 32: def disconnect 33: Log.debug("Disconnecting from the middleware") 34: @connection.disconnect -35: end --
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 - -# File lib/mcollective/client.rb, line 117 117: def discover(filter, timeout, limit=0) 118: discovered = @discoverer.discover(filter, timeout, limit) -119: end --
(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 +
+Prints out the stats returns from req and discovered_req in a nice way
- -# 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 --
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.
- -# 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 --
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 - -+ + + +--# 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 responses
- -# 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 --
Starts the request publishing routine
- -# 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 --
Starts the response receiver routine Expected to return the amount of received responses.
- -# 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 --
Starts the client receiver and publisher in threads. This is activated when the ‘threader_client’ configuration option is set.
- -# 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 --
(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 --
Starts the client receiver and publisher unthreaded. This is the default client behaviour.
- -# 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 --
(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 --
Disabled; run with --debug to generate this.
+ +Generated with the Darkfish + Rdoc Generator 1.1.6.
+