|<B>simple_service($name)B>||Should return subservice by its short name (i.e. name without dot separators in it).|
|<B>B>service_names()<B>B>||Should return list with the names of all top-level subservices.|
These methods can be overloaded for a performance boost or some non-trivial tasks, but their default implementation should be adequate in 99% of the cases.
<B>service($name)B> Get service by name.
This class provides a common implementation which can delegate searching of subservices to multiservices (dont panic!), so subclasses should implement simple_service instead.
All subservices are cached forever.
<B>has_service($name)B> Check whether service with specified name exists in this multiservice.
Like service, subclasses should usually implement has_simple_service instead.
<B>B>services()<B>B> Construct all top-level subservices.
By default, it uses service_names to get the list of names.
<B>has_simple_service($name)B> Returns true if $name is a subservice of this multiservice.
Default implementation calls $self->service_names, so you might want to reimplement it in subclasses for a performance reasons.
<B>B>multiop()<B>B> Get multiop operation mode of a multiservice. There are three possible values which this method can return:
allowed start, stop, restart actions for this module start/stop/restart all subservices. This is the default. protected -f flag in ubic(1) binary is required to call any action. forbidden ubic(1) binary will refuse to start/stop/restart this multiservice.
Although multiservice class is inherited from Ubic::Service class, it doesnt and shouldnt implement start/stop/status methods. This is because user will usually want to see actions progress, and all output policy is defined in Ubic::Cmd class; interaction protocol between this class and Ubic::Cmd class would be too complex.
This may be fixed in future: either Ubic::Multiservice will no longer inherit from Ubic::Service, or start/stop methods will be implemented with renderer object as an argument. Until then, please dont override these methods in subclasses.
user, group and other metadata methods are not used for multiservices too.
Subservices are cached forever; this can cause troubles, but it is necessary to avoid memory leaks in persistent programs, for example, in Ubic::Ping.
Ubic::Multiservice::Simple - class for defining simple multiservices.
Ubic::Multiservice::Dir - multiservice which loads service configs from files.
Vyacheslav Matyukhin <email@example.com>
This software is copyright (c) 2015 by Yandex LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|perl v5.20.3||UBIC::MULTISERVICE (3)||2015-01-27|