Ubic::Multiservice - interface of multiservice representing several named services
version 1.44_01
$service = $multiservice->service("multiservice-x.multiservice-y.service-z"); @services = $multiservice->services();
Multiservices are objects with simple list/get API which is used to fill ubic service tree.
This is an abstract base class for all multiservices.
Actual multiservice classes should inherit from this class and implement methods from "ABSTRACT METHODS" section.
These methods have to be overloaded by subclasses:
Should return subservice by its short name (i.e. name without dot separators in it).
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.
Get service by name.
This class provides a common implementation which can delegate searching of subservices to multiservices (don't panic!), so subclasses should implement simple_service instead.
simple_service
All subservices are cached forever.
Check whether service with specified name exists in this multiservice.
Like service, subclasses should usually implement has_simple_service instead.
service
has_simple_service
Construct all top-level subservices.
By default, it uses service_names to get the list of names.
service_names
Returns true if $name is a subservice of this multiservice.
$name
Default implementation calls $self->service_names, so you might want to reimplement it in subclasses for a performance reasons.
$self->service_names
Get multiop operation mode of a multiservice. There are three possible values which this method can return:
start, stop, restart actions for this module start/stop/restart all subservices. This is the default.
start
stop
restart
-f flag in ubic(1) binary is required to call any action.
ubic(1) binary will refuse to start/stop/restart this multiservice.
Although multiservice class is inherited from Ubic::Service class, it doesn't and shouldn't implement start/stop/status methods. This is because user will usually want to see action's progress, and all output policy is defined in Ubic::Cmd class; interaction protocol between this class and Ubic::Cmd class would be too complex.
Ubic::Service
Ubic::Cmd
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 don't override these methods in subclasses.
Ubic::Multiservice
user, group and other metadata methods are not used for multiservices too.
user
group
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::Ping
Ubic::Multiservice::Simple - class for defining simple multiservices.
Ubic::Multiservice::Dir - multiservice which loads service configs from files.
Vyacheslav Matyukhin <mmcleric@yandex-team.ru>
This software is copyright (c) 2012 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.
To install Ubic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ubic
CPAN shell
perl -MCPAN -e shell install Ubic
For more information on module installation, please visit the detailed CPAN module installation guide.