Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
PluginFacade.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICEGRID_PLUGIN_FACADE_H
4#define ICEGRID_PLUGIN_FACADE_H
5
6#include "Ice/Ice.h"
7#include "IceGrid/Admin.h"
8
9namespace IceGrid
10{
11 /// The ReplicaGroupFilter is used by IceGrid to filter adapters returned to the client when it resolves a filtered
12 /// replica group.
13 /// IceGrid provides the list of available adapters. The implementation of this method can use the provided context
14 /// and connection to filter and return the filtered set of adapters.
15 /// @headerfile IceGrid/IceGrid.h
17 {
18 public:
19 virtual ~ReplicaGroupFilter() = default;
20
21 /// Filters adapter IDs.
22 /// @param replicaGroupId The replica group ID.
23 /// @param adapterIds The adapter IDs to filter.
24 /// @param con The connection from the Ice client which is resolving the replica group endpoints.
25 /// @param ctx The request context from the Ice client which is resolving the replica group endpoints.
26 /// @return The filtered adapter IDs.
28 const std::string& replicaGroupId,
29 const Ice::StringSeq& adapterIds,
30 const Ice::ConnectionPtr& con,
31 const Ice::Context& ctx) = 0;
32 };
33
34 /// The TypeFilter is used by IceGrid to filter well-known proxies returned to the client when it searches a
35 /// well-known object by type. IceGrid provides the list of available proxies. The implementation of this method can
36 /// use the provided context and connection to filter and return the filtered set of proxies.
37 /// @headerfile IceGrid/IceGrid.h
39 {
40 public:
41 virtual ~TypeFilter() = default;
42
43 /// Filters the given set of proxies.
44 /// @param type The type.
45 /// @param proxies The proxies to filter.
46 /// @param con The connection from the Ice client which is looking up well-known objects by type.
47 /// @param ctx The context from the Ice client which is looking up well-known objects by type.
48 /// @return The filtered proxies.
50 const std::string& type,
51 const Ice::ObjectProxySeq& proxies,
52 const Ice::ConnectionPtr& con,
53 const Ice::Context& ctx) = 0;
54 };
55
56 /// The RegistryPluginFacade is implemented by IceGrid and can be used by plugins and filter implementations to
57 /// retrieve information from IceGrid about the well-known objects or adapters. It's also used to
58 /// register/unregister replica group and type filters.
59 /// @headerfile IceGrid/IceGrid.h
61 {
62 public:
63 virtual ~RegistryPluginFacade();
64
65 /// Gets an application descriptor.
66 /// @param name The application name.
67 /// @return The application descriptor.
68 /// @throws IceGrid::ApplicationNotExistException Thrown when the application doesn't exist.
69 [[nodiscard]] virtual ApplicationInfo getApplicationInfo(const std::string& name) const = 0;
70
71 /// Gets the server information for the server with the given id.
72 /// @param id The server id.
73 /// @return The server information.
74 /// @throws IceGrid::ServerNotExistException Thrown when the server doesn't exist.
75 [[nodiscard]] virtual ServerInfo getServerInfo(const std::string& id) const = 0;
76
77 /// Gets the ID of the server to which the given adapter belongs.
78 /// @param adapterId The adapter ID.
79 /// @return The server ID or the empty string if the given identifier is not associated to an object adapter
80 /// defined with an application descriptor.
81 /// @throws IceGrid::AdapterNotExistException Thrown when the adapter doesn't exist.
82 [[nodiscard]] virtual std::string getAdapterServer(const std::string& adapterId) const = 0;
83
84 /// Gets the name of the application to which the given adapter belongs.
85 /// @param adapterId The adapter ID.
86 /// @return The application name or the empty string if the given identifier is not associated to a replica
87 /// group or object adapter defined with an application descriptor.
88 /// @throws IceGrid::AdapterNotExistException Thrown when the adapter doesn't exist.
89 [[nodiscard]] virtual std::string getAdapterApplication(const std::string& adapterId) const = 0;
90
91 /// Gets the name of the node to which the given adapter belongs.
92 /// @param adapterId The adapter ID.
93 /// @return The node name or the empty string if the given identifier is not associated to an object adapter
94 /// defined with an application descriptor.
95 /// @throws IceGrid::AdapterNotExistException Thrown when the adapter doesn't exist.
96 [[nodiscard]] virtual std::string getAdapterNode(const std::string& adapterId) const = 0;
97
98 /// Gets the adapter information for the replica group or adapter with the given id.
99 /// @param id The adapter id.
100 /// @return A sequence of adapter information structures. If the given id refers to an adapter, this sequence
101 /// will contain only one element. If the given id refers to a replica group, the sequence will contain the
102 /// adapter information of each member of the replica group.
103 /// @throws IceGrid::AdapterNotExistException Thrown when the adapter or replica group doesn't exist.
104 [[nodiscard]] virtual AdapterInfoSeq getAdapterInfo(const std::string& id) const = 0;
105
106 /// Gets the object info for the object with the given identity.
107 /// @param id The identity of the object.
108 /// @return The object info.
109 /// @throws IceGrid::ObjectNotRegisteredException Thrown when the object isn't registered with the registry.
110 [[nodiscard]] virtual ObjectInfo getObjectInfo(const Ice::Identity& id) const = 0;
111
112 /// Gets the node information for the node with the given name.
113 /// @param name The node name.
114 /// @return The node information.
115 /// @throws IceGrid::NodeNotExistException Thrown when the node doesn't exist.
116 /// @throws IceGrid::NodeUnreachableException Thrown when the node could not be reached.
117 [[nodiscard]] virtual NodeInfo getNodeInfo(const std::string& name) const = 0;
118
119 /// Gets the load averages of the node.
120 /// @param name The node name.
121 /// @return The node load information.
122 /// @throws IceGrid::NodeNotExistException Thrown when the node doesn't exist.
123 /// @throws IceGrid::NodeUnreachableException Thrown when the node could not be reached.
124 [[nodiscard]] virtual LoadInfo getNodeLoad(const std::string& name) const = 0;
125
126 /// Gets the property value for the given property and adapter. The property is looked up in the server or
127 /// service descriptor where the adapter is defined.
128 /// @param adapterId The adapter ID
129 /// @param name The name of the property.
130 /// @return The property value.
131 /// @throws IceGrid::AdapterNotExistException Thrown when the adapter doesn't exist.
132 [[nodiscard]] virtual std::string
133 getPropertyForAdapter(const std::string& adapterId, const std::string& name) const = 0;
134
135 /// Adds a replica group filter.
136 /// @param id The identifier of the filter. This identifier must match the value of the "filter" attribute
137 /// specified in the replica group descriptor. To filter dynamically registered replica groups, you should use
138 /// the empty filter id.
139 /// @param filter The filter implementation.
140 virtual void
141 addReplicaGroupFilter(const std::string& id, const std::shared_ptr<ReplicaGroupFilter>& filter) noexcept = 0;
142
143 /// Removes a replica group filter.
144 /// @param id The identifier of the filter.
145 /// @param filter The filter implementation.
146 /// @return `true` of the filter was removed, `false` otherwise.
147 virtual bool
148 removeReplicaGroupFilter(const std::string& id, const std::shared_ptr<ReplicaGroupFilter>& filter) noexcept = 0;
149
150 /// Adds a type filter.
151 /// @param type The type to register this filter with.
152 /// @param filter The filter implementation.
153 virtual void addTypeFilter(const std::string& type, const std::shared_ptr<TypeFilter>& filter) noexcept = 0;
154
155 /// Removes a type filter.
156 /// @param type The type to register this filter with.
157 /// @param filter The filter implementation.
158 /// @return `true` of the filter was removed, `false` otherwise.
159 virtual bool removeTypeFilter(const std::string& type, const std::shared_ptr<TypeFilter>& filter) noexcept = 0;
160 };
161
162 /// A shared pointer to a ReplicaGroupFilter.
163 using ReplicaGroupFilterPtr = std::shared_ptr<ReplicaGroupFilter>;
164
165 /// A shared pointer to a TypeFilter.
166 using TypeFilterPtr = std::shared_ptr<TypeFilter>;
167
168 /// A shared pointer to a RegistryPluginFacade.
169 using RegistryPluginFacadePtr = std::shared_ptr<RegistryPluginFacade>;
170
171 /// Gets the plug-in facade for the IceGrid registry.
172 /// @return The plug-in facade.
174}
175
176#endif
virtual AdapterInfoSeq getAdapterInfo(const std::string &id) const =0
Gets the adapter information for the replica group or adapter with the given id.
virtual NodeInfo getNodeInfo(const std::string &name) const =0
Gets the node information for the node with the given name.
virtual std::string getAdapterApplication(const std::string &adapterId) const =0
Gets the name of the application to which the given adapter belongs.
virtual bool removeReplicaGroupFilter(const std::string &id, const std::shared_ptr< ReplicaGroupFilter > &filter) noexcept=0
Removes a replica group filter.
virtual void addTypeFilter(const std::string &type, const std::shared_ptr< TypeFilter > &filter) noexcept=0
Adds a type filter.
virtual bool removeTypeFilter(const std::string &type, const std::shared_ptr< TypeFilter > &filter) noexcept=0
Removes a type filter.
virtual ServerInfo getServerInfo(const std::string &id) const =0
Gets the server information for the server with the given id.
virtual std::string getPropertyForAdapter(const std::string &adapterId, const std::string &name) const =0
Gets the property value for the given property and adapter.
virtual std::string getAdapterNode(const std::string &adapterId) const =0
Gets the name of the node to which the given adapter belongs.
virtual LoadInfo getNodeLoad(const std::string &name) const =0
Gets the load averages of the node.
virtual ObjectInfo getObjectInfo(const Ice::Identity &id) const =0
Gets the object info for the object with the given identity.
virtual void addReplicaGroupFilter(const std::string &id, const std::shared_ptr< ReplicaGroupFilter > &filter) noexcept=0
Adds a replica group filter.
virtual std::string getAdapterServer(const std::string &adapterId) const =0
Gets the ID of the server to which the given adapter belongs.
virtual ApplicationInfo getApplicationInfo(const std::string &name) const =0
Gets an application descriptor.
The RegistryPluginFacade is implemented by IceGrid and can be used by plugins and filter implementati...
virtual Ice::StringSeq filter(const std::string &replicaGroupId, const Ice::StringSeq &adapterIds, const Ice::ConnectionPtr &con, const Ice::Context &ctx)=0
Filters adapter IDs.
The ReplicaGroupFilter is used by IceGrid to filter adapters returned to the client when it resolves ...
virtual Ice::ObjectProxySeq filter(const std::string &type, const Ice::ObjectProxySeq &proxies, const Ice::ConnectionPtr &con, const Ice::Context &ctx)=0
Filters the given set of proxies.
The TypeFilter is used by IceGrid to filter well-known proxies returned to the client when it searche...
std::shared_ptr< ReplicaGroupFilter > ReplicaGroupFilterPtr
A shared pointer to a ReplicaGroupFilter.
std::vector< AdapterInfo > AdapterInfoSeq
A sequence of AdapterInfo.
Definition Admin.h:80
std::shared_ptr< RegistryPluginFacade > RegistryPluginFacadePtr
A shared pointer to a RegistryPluginFacade.
std::shared_ptr< TypeFilter > TypeFilterPtr
A shared pointer to a TypeFilter.
ICEGRID_API RegistryPluginFacadePtr getRegistryPluginFacade()
Gets the plug-in facade for the IceGrid registry.
Deploy and manage Ice servers.
Definition Admin.h:34
std::vector< std::optional< Ice::ObjectPrx > > ObjectProxySeq
A sequence of object proxies.
std::vector< std::string > StringSeq
A sequence of strings.
std::shared_ptr< Connection > ConnectionPtr
A shared pointer to a Connection.
Definition ConnectionF.h:18
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.
Definition Context.h:28
Information about an IceGrid application.
Definition Admin.h:3164
Information about the load of a node.
Definition Admin.h:3133
Information about an IceGrid node.
Definition Admin.h:3058
Information about an Ice well-known object.
Definition Admin.h:2959
Information about a server managed by an IceGrid node.
Definition Admin.h:3018
Represents the identity of an Ice object.
Definition Identity.h:40