ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.40 by root, Mon Sep 7 18:42:53 2009 UTC vs.
Revision 1.41 by root, Fri Sep 11 02:32:23 2009 UTC

9 aemp command args... 9 aemp command args...
10 10
11 # protocol commands 11 # protocol commands
12 aemp snd <port> <arg...> # send a message 12 aemp snd <port> <arg...> # send a message
13 aemp mon <port> # wait till port is killed 13 aemp mon <port> # wait till port is killed
14 aemp rpc <port> <arg...> # send message, append reply 14 aemp cal <port> <arg...> # send message, append reply
15 aemp eval <node> <expr...> # evaluate expression 15 aemp eval <node> <expr...> # evaluate expression
16 aemp trace <node> # trace the network topology 16 aemp trace <node> # trace the network topology
17 17
18 # run a node 18 # run a node
19 aemp run configure_args... # run a node 19 aemp run configure_args... # run a node
154Most useful to take advantage of some undocumented functionality inside 154Most useful to take advantage of some undocumented functionality inside
155nodes, such as node ports being able to call any method: 155nodes, such as node ports being able to call any method:
156 156
157 aemp snd doomed AnyEvent::Watchdog::restart 1 157 aemp snd doomed AnyEvent::Watchdog::restart 1
158 158
159=item rpc <port> <arg...> 159=item cal <port> <arg...>
160 160
161Like F<aemp snd>, but appends a local reply port to the message and waits 161Like F<aemp cal>: appends a local reply port to the message and waits for
162for a message to it. 162a message to it.
163 163
164Any return values will be JSON-encoded and printed separated by commas 164Any return values will be JSON-encoded and printed separated by commas
165(kind of like a JSON array without []-brackets). 165(kind of like a JSON array without []-brackets).
166 166
167Example: ask the (undocumented) time service of a node for it's current 167Example: ask the (undocumented) time service of a node for its current
168time. 168time.
169 169
170 aemp rpc mynode time 170 aemp cal mynode time
171 171
172=item mon <port> 172=item mon <port>
173 173
174Monitors the port and exits when it's monitorign callback is called. Most 174Monitors the port and exits when it's monitorign callback is called. Most
175useful to monitor node ports. 175useful to monitor node ports.
179 aemp mon doomed 179 aemp mon doomed
180 180
181=item eval <node> <expr...> 181=item eval <node> <expr...>
182 182
183Joins all remaining arguments into a string and evaluates it on the given 183Joins all remaining arguments into a string and evaluates it on the given
184node. Return values are handled as with F<aemp rpc>. 184node. Return values are handled as with F<aemp cal>.
185 185
186Example: find the unix process ID of the node called posicks. 186Example: find the unix process ID of the node called posicks.
187 187
188 aemp eval posicks '$$' 188 aemp eval posicks '$$'
189 189
581 snd node_of $port, snd => $reply, "message sent successfully"; 581 snd node_of $port, snd => $reply, "message sent successfully";
582 582
583 print join " ", $cv->recv, "\n"; 583 print join " ", $cv->recv, "\n";
584 }, 584 },
585 585
586 rpc => sub { 586 cal => sub {
587 my $port = shift @ARGV; 587 my $port = shift @ARGV;
588 init; 588 init;
589 589
590 my $cv = AE::cv; 590 my $cv = AE::cv;
591 my $to = AE::timer 5, 0, sub { exit 1 };
592 snd $port, @ARGV, port { &$cv }; @ARGV = (); 591 cal $port, @ARGV, sub { &$cv }; @ARGV = ();
593 mon $port, $cv;
594 592
595 print +(substr JSON::XS->new->encode ([$cv->recv]), 1, -1), "\n"; 593 print +(substr JSON::XS->new->encode ([$cv->recv]), 1, -1), "\n";
596 }, 594 },
597 595
598 mon => sub { 596 mon => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines