- ABSTRACT METHODS
- BUGS AND CAVEATS
- SEE ALSO
- COPYRIGHT AND LICENSE
Ubic::Multiservice - interface of multiservice representing several named services
$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
All subservices are cached forever.
Check whether service with specified name exists in this multiservice.
service, subclasses should usually implement
Construct all top-level subservices.
By default, it uses
service_namesto get the list of names.
Returns true if
$nameis a subservice of this multiservice.
Default implementation calls
$self->service_names, so you might want to reimplement it in subclasses for a performance reasons.
Get multiop operation mode of a multiservice. There are three possible values which this method can return:
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.
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.
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::Multiservice::Simple - class for defining simple multiservices.
Ubic::Multiservice::Dir - multiservice which loads service configs from files.
Vyacheslav Matyukhin <firstname.lastname@example.org>
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.