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.25 by root, Sun Aug 30 19:49:47 2009 UTC vs.
Revision 1.26 by root, Mon Aug 31 10:07:04 2009 UTC

14 aemp rpc <port> <arg...> # send message, append reply 14 aemp rpc <port> <arg...> # send message, append reply
15 aemp eval <node> <expr...> # evaluate expression 15 aemp eval <node> <expr...> # evaluate expression
16 aemp trace <nodeid> # trace the network topology 16 aemp trace <nodeid> # trace the network topology
17 17
18 # run a node 18 # run a node
19 aemp run initialise_args... # run a node 19 aemp run configure_args... # run a node
20 20
21 # node configuration: node ID 21 # node configuration: node ID
22 aemp setnodeid <nodeid> # configure the real node id 22 aemp setnodeid <nodeid> # configure the real node id
23 aemp delnodeid # reset node id to default (= inherit) 23 aemp delnodeid # reset node id to default (= inherit)
24 24
50 aemp addservice <initfunc> # add an instance of a service 50 aemp addservice <initfunc> # add an instance of a service
51 aemp delservice <initfunc> # delete one instance of a service 51 aemp delservice <initfunc> # delete one instance of a service
52 52
53 # profile-specific configuration 53 # profile-specific configuration
54 aemp profile <name> <command>... # apply command to profile only 54 aemp profile <name> <command>... # apply command to profile only
55 aemp parent <name> # specify a parent profile 55 aemp setparent <name> # specify a parent profile
56 aemp delparent # clear parent again 56 aemp delparent # clear parent again
57 aemp delprofile <name> # eradicate the named profile 57 aemp delprofile <name> # eradicate the named profile
58 aemp showprofile <name> # display given profile 58 aemp showprofile <name> # display given profile
59 aemp showconfig <name> ... # display effective config 59 aemp showconfig <name> ... # display effective config
60 60
81 81
82=over 4 82=over 4
83 83
84=item run <profile> <...> 84=item run <profile> <...>
85 85
86Runs a node by calling C<AnyEvent::MP::initialise_node> with the given 86Runs a node by calling C<AnyEvent::MP::Kernel::configure> with the given
87arguments. The node runs under L<AnyEvent::Watchdog>, can be restarted 87arguments. The node runs under L<AnyEvent::Watchdog>, can be restarted
88(and autorestarted, see the L<AnyEvent::Watchdog> manual). 88(and autorestarted, see the L<AnyEvent::Watchdog> manual).
89 89
90Care has been taken to load (almost) no modules other than 90Care has been taken to load (almost) no modules other than
91L<AnyEvent::Watchdog> and the modules it loads, so everything (including 91L<AnyEvent::Watchdog> and the modules it loads, so everything (including
342 342
343=item delprofile <name> 343=item delprofile <name>
344 344
345Deletes the profile of the given name. 345Deletes the profile of the given name.
346 346
347=item parent <name> 347=item setparent <name>
348 348
349Sets the parent profile to use - values not specified in a profile will be 349Sets the parent profile to use - values not specified in a profile will be
350taken from the parent profile (even recursively, with the global default 350taken from the parent profile (even recursively, with the global default
351config being the default parent). This is useful to configure profile 351config being the default parent). This is useful to configure profile
352I<classes> and then to inherit from them for individual nodes. 352I<classes> and then to inherit from them for individual nodes.
355global configuration. Neither will do you any good, however. 355global configuration. Neither will do you any good, however.
356 356
357Example: inherit all values not specified in the C<doomed> profile from 357Example: inherit all values not specified in the C<doomed> profile from
358the C<server> profile. 358the C<server> profile.
359 359
360 aemp profile doomed parent server 360 aemp profile doomed setparent server
361 361
362=item delparent 362=item delparent
363 363
364Removes the parent again from the profile, if any was set, so the profile 364Removes the parent again from the profile, if any was set, so the profile
365inherits directly from the global default config again. 365inherits directly from the global default config again.
371 371
372=item showconfig <name> <key value...> 372=item showconfig <name> <key value...>
373 373
374Shows the I<effective> config, i.e. the values as used by a node started 374Shows the I<effective> config, i.e. the values as used by a node started
375with the given profile name. Any additional key-value pairs specified 375with the given profile name. Any additional key-value pairs specified
376augment the configuration, just as with C<initialise_node>. 376augment the configuration, just as with C<configure>.
377 377
378If all arguments are omitted, show the global default config. 378If all arguments are omitted, show the global default config.
379 379
380=back 380=back
381 381
396 AnyEvent::Watchdog::autorestart (1); 396 AnyEvent::Watchdog::autorestart (1);
397 AnyEvent::Watchdog::heartbeat (300); 397 AnyEvent::Watchdog::heartbeat (300);
398 398
399 require AnyEvent; 399 require AnyEvent;
400 require AnyEvent::MP::Kernel; 400 require AnyEvent::MP::Kernel;
401 AnyEvent::MP::Kernel::initialise_node (@ARGV); 401 AnyEvent::MP::Kernel::configure (@ARGV);
402 402
403 AnyEvent::detect () eq "AnyEvent::Impl::EV" 403 AnyEvent::detect () eq "AnyEvent::Impl::EV"
404 ? EV::loop () 404 ? EV::loop ()
405 : AE::cv ()->recv; 405 : AE::cv ()->recv;
406 } 406 }
439 439
440 "$cert$key" 440 "$cert$key"
441} 441}
442 442
443sub init { 443sub init {
444 initialise_node aemp => nodeid => "anon/", binds => ["*:*"]; 444 configure profile => "aemp", nodeid => "anon/";
445} 445}
446 446
447our $cfg = AnyEvent::MP::Config::config; 447our $cfg = AnyEvent::MP::Config::config;
448our $profile = $cfg; 448our $profile = $cfg;
449 449
691 my $name = shift @ARGV; 691 my $name = shift @ARGV;
692 692
693 delete $cfg->{profile}{$name}; 693 delete $cfg->{profile}{$name};
694 ++$cfg->{dirty}; 694 ++$cfg->{dirty};
695 }, 695 },
696 parent => sub { 696 setparent => sub {
697 @ARGV >= 1 697 @ARGV >= 1
698 or die "profile name is missing\n"; 698 or die "profile name is missing\n";
699 699
700 $profile->{parent} = shift @ARGV; 700 $profile->{parent} = shift @ARGV;
701 ++$cfg->{dirty}; 701 ++$cfg->{dirty};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines