unity.scopes.Registry

White pages service for available scopes. More...

#include <unity/scopes/Registry.h>

Inheritance diagram for unity::scopes::Registry: src="https://assets.ubuntu.com/v1/7748ae41-classunity_1_1scopes_1_1_registry__inherit__graph.png" border="0" alt="Inheritance graph"/>

Public Member Functions

virtual ScopeMetadata get_metadata (std::string const &scope_id)=0
 Returns the metadata for the scope with the given ID. More...
 
virtual MetadataMap list ()=0
 Returns a map containing the metadata for all scopes. More...
 
virtual MetadataMap list_if (std::function< bool(ScopeMetadata const &item)> predicate)=0
 Returns a map containing only those scopes for which predicate returns true. More...
 
virtual bool is_scope_running (std::string const &scope_id)=0
 Returns whether a scope is currently running or not. More...
 
virtual core::ScopedConnection set_scope_state_callback (std::string const &scope_id, std::function< void(bool is_running)> callback)=0
 Assigns a callback method to be executed when a scope's running state (started / stopped) changes. More...
 
virtual core::ScopedConnection set_list_update_callback (std::function< void()> callback)=0
 Assigns a callback method to be executed when the registry's scope list changes. More...
 
src="https://assets.ubuntu.com/v1/c6607712-closed.png" alt="-"/> Public Member Functions inherited from unity::scopes::Object
virtual std::string endpoint ()=0
 Returns the endpoint this proxy connects to. More...
 
virtual std::string identity ()=0
 Returns the identity of the target object of this proxy. More...
 
virtual std::string target_category ()=0
 Returns the category of the target object of this proxy. More...
 
virtual int64_t timeout ()=0
 Returns the timeout in milliseconds if this proxy is a twoway proxy. More...
 
virtual std::string to_string ()=0
 Converts a proxy into its string representation. More...
 

Detailed Description

White pages service for available scopes.

You can obtain a proxy to the registry by calling Runtime::registry().

Member Function Documentation

virtual ScopeMetadata unity::scopes::Registry::get_metadata ( std::string const &  scope_id)
pure virtual

Returns the metadata for the scope with the given ID.

Parameters
scope_idThe ID of the scope from which we wish to retrieve metadata.
Returns
The metadata for the scope.
Exceptions
NotFoundExceptionif no scope with the given ID exists.
virtual bool unity::scopes::Registry::is_scope_running ( std::string const &  scope_id)
pure virtual

Returns whether a scope is currently running or not.

Parameters
scope_idThe ID of the scope from which we wish to retrieve state.
Returns
True if the scope is running, and False if it is not running.
Exceptions
NotFoundExceptionif no scope with the given ID exists.
virtual MetadataMap unity::scopes::Registry::list ( )
pure virtual

Returns a map containing the metadata for all scopes.

Returns
The metadata for all scopes.
virtual MetadataMap unity::scopes::Registry::list_if ( std::function< bool(ScopeMetadata const &item)>  predicate)
pure virtual

Returns a map containing only those scopes for which predicate returns true.

Parameters
predicatea function object that must return true for each metadata item to be included in the map.
Returns
The metadata items for which the predicate returned true.
virtual core::ScopedConnection unity::scopes::Registry::set_list_update_callback ( std::function< void()>  callback)
pure virtual

Assigns a callback method to be executed when the registry's scope list changes.

Note: Upon receiving this callback, you should retrieve the updated scopes list via the list() method if you wish to retain synchronisation between client and server.

Parameters
callbackThe function object that is invoked when an update occurs.
Exceptions
MiddlewareExceptionif the registry subscriber failed to initialize.
virtual core::ScopedConnection unity::scopes::Registry::set_scope_state_callback ( std::string const &  scope_id,
std::function< void(bool is_running)>  callback 
)
pure virtual

Assigns a callback method to be executed when a scope's running state (started / stopped) changes.

Parameters
scope_idThe ID of the scope from which we wish to retrieve state changes.
callbackThe function object that is invoked when a scope changes running state.
Exceptions
MiddlewareExceptionif the registry subscriber failed to initialize.