diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-15 07:52:35 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-15 07:52:35 +0000 |
commit | d891d35a7dc7bf0ee3d47be9d6706836f5cc076c (patch) | |
tree | 4fdb3ad5c80f57cc14dddde6d7c0f5bc4847ae2c /cpp | |
parent | Bug 386. (diff) | |
download | ice-d891d35a7dc7bf0ee3d47be9d6706836f5cc076c.tar.bz2 ice-d891d35a7dc7bf0ee3d47be9d6706836f5cc076c.tar.xz ice-d891d35a7dc7bf0ee3d47be9d6706836f5cc076c.zip |
Reviewed slice comments
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/slice/IceGrid/Admin.ice | 199 | ||||
-rw-r--r-- | cpp/slice/IceGrid/Descriptor.ice | 134 | ||||
-rw-r--r-- | cpp/slice/IceGrid/Observer.ice | 227 | ||||
-rw-r--r-- | cpp/src/IceGrid/Database.cpp | 4 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 6 | ||||
-rw-r--r-- | cpp/test/IceGrid/update/AllTests.cpp | 4 |
6 files changed, 425 insertions, 149 deletions
diff --git a/cpp/slice/IceGrid/Admin.ice b/cpp/slice/IceGrid/Admin.ice index c242965df5b..7ac8075de81 100644 --- a/cpp/slice/IceGrid/Admin.ice +++ b/cpp/slice/IceGrid/Admin.ice @@ -14,11 +14,17 @@ #include <Ice/BuiltinSequences.ice> #include <Ice/SliceChecksumDict.ice> #include <IceGrid/Exception.ice> +#include <IceGrid/Observer.ice> #include <IceGrid/Descriptor.ice> module IceGrid { +/** + * + * A dictionary of proxies. + * + **/ dictionary<string, Object*> StringObjectProxyDict; /** @@ -46,25 +52,61 @@ enum ServerActivation Manual }; +/** + * + * Information on an Ice object. + * + **/ struct ObjectInfo { - /** The proxy of the object. */ + /** + * + * The proxy of the object. + * + **/ Object* proxy; - /** The type of the object. */ + /** + * + * The type of the object. + * + **/ string type; }; + +/** + * + * A sequence of object information structures. + * + **/ sequence<ObjectInfo> ObjectInfoSeq; +/** + * + * Information on a server managed by an IceGrid node. + * + **/ struct ServerInfo { - /** The server application. */ + /** + * + * The server application. + * + **/ string application; - /** The server node. */ + /** + * + * The server node. + * + **/ string node; - /** The server descriptor. */ + /** + * + * The server descriptor. + * + **/ ServerDescriptor descriptor; }; @@ -83,9 +125,8 @@ interface Admin * * @param descriptor The application descriptor. * - * @throws DeploymentException Raised if application deployment failed. - * - * @see removeApplication + * @throws DeploymentException Raised if application deployment + * failed. * **/ void addApplication(ApplicationDescriptor descriptor) @@ -94,14 +135,16 @@ interface Admin /** * * Synchronize a deployed application with the given application - * descriptor. + * descriptor. This operation will replace the current descriptor + * with this new descriptor. * * @param descriptor The application descriptor. * * @throws DeploymentException Raised if application deployment * failed. * - * @see removeApplication + * @throws ApplicationNotExistException Raised if the application + * doesn't exist. * **/ void syncApplication(ApplicationDescriptor descriptor) @@ -117,8 +160,8 @@ interface Admin * @throws DeploymentException Raised if application deployment * failed. * - * @see syncApplication - * @see removeApplication + * @throws ApplicationNotExistException Raised if the application + * doesn't exist. * **/ void updateApplication(ApplicationUpdateDescriptor descriptor) @@ -126,20 +169,12 @@ interface Admin /** * - * Get all the &IceGrid; applications currently registered. - * - * @return The application names. - * - **/ - nonmutating Ice::StringSeq getAllApplicationNames(); - - /** - * * Remove an application from &IceGrid;. * * @param name The application name. * - * @see addApplication + * @throws ApplicationNotExistException Raised if the application + * doesn't exist. * **/ void removeApplication(string name) @@ -160,6 +195,9 @@ interface Admin * * @throws PatchException Raised if the patch failed. * + * @throws ApplicationNotExistException Raised if the application + * doesn't exist. + * **/ void patchApplication(string name, string patch, bool shutdown) throws ApplicationNotExistException, PatchException; @@ -170,14 +208,23 @@ interface Admin * * @param name The application name. * - * @throws ApplicationNotExistException Raised if the application doesn't exist. - * * @returns The application descriptor. * + * @throws ApplicationNotExistException Raised if the application + * doesn't exist. + * **/ nonmutating ApplicationDescriptor getApplicationDescriptor(string name) throws ApplicationNotExistException; + /** + * + * Get all the &IceGrid; applications currently registered. + * + * @return The application names. + * + **/ + nonmutating Ice::StringSeq getAllApplicationNames(); /** * @@ -201,15 +248,11 @@ interface Admin * * @return The server state. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. * - * @see getServerPid - * @see getAllServerIds - * **/ nonmutating ServerState getServerState(string id) throws ServerNotExistException, NodeUnreachableException; @@ -223,15 +266,11 @@ interface Admin * * @return The server process id. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. * - * @see getServerState - * @see getAllServerIds - * **/ nonmutating int getServerPid(string id) throws ServerNotExistException, NodeUnreachableException; @@ -244,51 +283,50 @@ interface Admin * * @return The server activation mode. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. * - * @see getServerState - * @see getAllServerIds - * **/ nonmutating ServerActivation getServerActivation(string id) throws ServerNotExistException, NodeUnreachableException; /** * - * Set the server's activation mode. + * Set the server's activation mode. + * + * NOTE: this won't change the registry database. This will only + * set the transient activation mode of the server on the node. To + * update the initial activation mode of the server you need to + * update its template or descriptor by updating the application + * descriptor. * * @param id The id of the server. * - * @return The server activation mode. + * @param mode The server activation mode. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. * - * @see getServerState - * @see getAllServerIds - * **/ void setServerActivation(string id, ServerActivation mode) throws ServerNotExistException, NodeUnreachableException; /** * - * Start a server. + * Start a server and wait for its activation. * * @param id The id of the server. * * @return True if the server was successfully started, false * otherwise. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. @@ -303,8 +341,8 @@ interface Admin * * @param id The id of the server. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. @@ -322,8 +360,8 @@ interface Admin * @param shutdown If true, servers depending on the data to patch * will be shutdown if necessary. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. @@ -342,8 +380,8 @@ interface Admin * * @param signal The signal, for example SIGTERM or 15. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. @@ -365,8 +403,8 @@ interface Admin * * @param fd 1 for stdout, 2 for stderr. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * * @throws NodeUnreachableException Raised if the node could not be * reached. @@ -381,8 +419,6 @@ interface Admin * * @return The server ids. * - * @see getServerState - * **/ nonmutating Ice::StringSeq getAllServerIds(); @@ -395,8 +431,11 @@ interface Admin * @return A dictionary of adapter direct proxy classified by * server id. * - * @throws AdapterNotExistException Raised if the adapter is not - * found. + * @throws AdapterNotExistException Raised if the adapter doesn't + * exist. + * + * @throws NodeUnreachableException Raised if the node could not be + * reached. * **/ nonmutating StringObjectProxyDict getAdapterEndpoints(string adapterId) @@ -406,11 +445,11 @@ interface Admin * * Remove the adapter with the given adapter id and server id. * - * @throws AdapterNotExistException Raised if the adapter is not - * found. + * @throws AdapterNotExistException Raised if the adapter doesn't + * exist. * - * @throws ServerNotExistException Raised if the server is not - * found. + * @throws ServerNotExistException Raised if the server doesn't + * exist. * **/ idempotent void removeAdapterWithServerId(string adapterId, string serverId) @@ -421,8 +460,8 @@ interface Admin * Remove the adapter with the given id. If the adapter is * replicated, all the replicas are removed. * - * @throws AdapterNotExistException Raised if the adapter is not - * found. + * @throws AdapterNotExistException Raised if the adapter doesn't + * exist. * **/ idempotent void removeAdapter(string adapterId) @@ -458,8 +497,8 @@ interface Admin * * @param obj The object to be updated to the registry. * - * @throws ObjectNotExistException Raised if the object cannot be - * found. + * @throws ObjectNotExistException Raised if the object doesn't + * exist. * **/ void updateObject(Object* obj) @@ -488,8 +527,8 @@ interface Admin * @param id The identity of the object to be removed from the * registry. * - * @throws ObjectNotExistException Raised if the object cannot be - * found. + * @throws ObjectNotExistException Raised if the object doesn't + * exist. * **/ void removeObject(Ice::Identity id) @@ -503,8 +542,8 @@ interface Admin * * @return The object info. * - * @throws ObjectNotExistExcpetion Raised if the object cannot be - * found. + * @throws ObjectNotExistException Raised if the object doesn't + * exist. * **/ nonmutating ObjectInfo getObjectInfo(Ice::Identity id) @@ -519,7 +558,7 @@ interface Admin * identities of registered objects. The expression may contain * a trailing wildcard (<literal>*</literal>) character. * - * @return All the object info with a stringified identity + * @return All the object infos with a stringified identity * matching the given expression. * **/ @@ -533,6 +572,8 @@ interface Admin * * @return true if the node ping succeeded, false otherwise. * + * @throws NodeNotExistException Raised if the node doesn't exist. + * **/ nonmutating bool pingNode(string name) throws NodeNotExistException; @@ -543,6 +584,11 @@ interface Admin * * @param name The node name. * + * @throws NodeNotExistException Raised if the node doesn't exist. + * + * @throws NodeUnreachableException Raised if the node could not be + * reached. + * **/ idempotent void shutdownNode(string name) throws NodeNotExistException, NodeUnreachableException; @@ -553,6 +599,11 @@ interface Admin * * @param name The node name. * + * @throws NodeNotExistException Raised if the node doesn't exist. + * + * @throws NodeUnreachableException Raised if the node could not be + * reached. + * **/ nonmutating string getNodeHostname(string name) throws NodeNotExistException, NodeUnreachableException; diff --git a/cpp/slice/IceGrid/Descriptor.ice b/cpp/slice/IceGrid/Descriptor.ice index e0a570daad5..88f9e35b7b5 100644 --- a/cpp/slice/IceGrid/Descriptor.ice +++ b/cpp/slice/IceGrid/Descriptor.ice @@ -196,7 +196,19 @@ struct PatchDescriptor /** The source directories. */ Ice::StringSeq sources; }; + +/** + * + * A sequence of patch descriptors. + * + **/ sequence<PatchDescriptor> PatchDescriptorSeq; + +/** + * + * A dictionary of patch descriptors. + * + **/ dictionary<string, PatchDescriptor> PatchDescriptorDict; /** @@ -274,14 +286,18 @@ class ServerDescriptor extends CommunicatorDescriptor /** * - * The application patch definition used by the server. + * The application patch definitions used by the server. * **/ Ice::StringSeq usePatchs; }; -dictionary<string, ServerDescriptor> ServerDescriptorDict; -["java:type:java.util.LinkedList"] sequence<ServerDescriptor> ServerDescriptorSeq; +/** + * + * A sequence of server descriptors. + * + **/ +["java:type:java.util.LinkedList"] sequence<ServerDescriptor> ServerDescriptorSeq; /** * @@ -304,9 +320,19 @@ class ServiceDescriptor extends CommunicatorDescriptor **/ string entry; }; -dictionary<string, ServiceDescriptor> ServiceDescriptorDict; + +/** + * + * A sequence of service descriptors. + * + **/ ["java:type:java.util.LinkedList"] sequence<ServiceDescriptor> ServiceDescriptorSeq; +/** + * + * A server template instance descriptor. + * + **/ struct ServerInstanceDescriptor { /** @@ -323,8 +349,13 @@ struct ServerInstanceDescriptor **/ StringStringDict parameterValues; }; + +/** + * + * A sequence of server instance descriptors. + * + **/ ["java:type:java.util.LinkedList"] sequence<ServerInstanceDescriptor> ServerInstanceDescriptorSeq; -dictionary<string, ServerInstanceDescriptor> ServerInstanceDescriptorDict; struct TemplateDescriptor { @@ -438,6 +469,14 @@ class RoundRobinLoadBalancingPolicy extends LoadBalancingPolicy class AdaptiveLoadBalancingPolicy extends LoadBalancingPolicy { + /** + * + * The load sample to use for the load balancing. The allowed + * values for this attribute are "1", "5" and "15", representing + * respectively the load average over the past minute, the past 5 + * minutes and the past 15 minutes. + * + **/ string loadSample; }; @@ -469,6 +508,12 @@ struct ReplicatedAdapterDescriptor **/ ObjectDescriptorSeq objects; }; + +/** + * + * A sequence of the replicated object adapters. + * + **/ ["java:type:java.util.LinkedList"] sequence<ReplicatedAdapterDescriptor> ReplicatedAdapterDescriptorSeq; /** @@ -534,14 +579,20 @@ struct ApplicationDescriptor **/ string description; }; -["java:type:java.util.LinkedList"] sequence<ApplicationDescriptor> ApplicationDescriptorSeq; -class BoxedDescription -{ - string value; -}; +/** + * + * A sequence of application descriptors. + * + **/ +["java:type:java.util.LinkedList"] sequence<ApplicationDescriptor> ApplicationDescriptorSeq; -class BoxedLoadFactor +/** + * + * A "boxed" string. + * + **/ +class BoxedString { string value; }; @@ -592,10 +643,11 @@ struct NodeUpdateDescriptor /** * - * The updated load factor of the node. + * The updated load factor of the node (or null if the load factor + * wasn't updated.) * **/ - BoxedLoadFactor loadFactor; + BoxedString loadFactor; }; ["java:type:java.util.LinkedList"] sequence<NodeUpdateDescriptor> NodeUpdateDescriptorSeq; @@ -610,10 +662,11 @@ struct ApplicationUpdateDescriptor /** * - * The updated description (or null if the description wasn't updated). + * The updated description (or null if the description wasn't + * updated.) * **/ - BoxedDescription description; + BoxedString description; /** * @@ -700,57 +753,6 @@ struct ApplicationUpdateDescriptor Ice::StringSeq removeNodes; }; -/** - * - * An enumeration representing the state of the server. - * - **/ -enum ServerState -{ - /** - * - * The server is not running. - * - **/ - Inactive, - - /** - * - * The server is being activated and will change to the active - * state when the registered server object adapters are activated. - * - **/ - Activating, - - /** - * - * The server is running. - * - **/ - Active, - - /** - * - * The server is being deactivated. - * - **/ - Deactivating, - - /** - * - * The server is being destroyed. - * - **/ - Destroying, - - /** - * - * The server is destroyed. - * - **/ - Destroyed -}; - }; #endif diff --git a/cpp/slice/IceGrid/Observer.ice b/cpp/slice/IceGrid/Observer.ice index c925120e1a5..880397f7ca5 100644 --- a/cpp/slice/IceGrid/Observer.ice +++ b/cpp/slice/IceGrid/Observer.ice @@ -11,55 +11,278 @@ #define ICE_GRID_OBSERVER_ICE #include <Glacier2/Session.ice> -#include <IceGrid/Descriptor.ice> #include <IceGrid/Exception.ice> +#include <IceGrid/Descriptor.ice> module IceGrid { +/** + * + * An enumeration representing the state of the server. + * + **/ +enum ServerState +{ + /** + * + * The server is not running. + * + **/ + Inactive, + + /** + * + * The server is being activated and will change to the active + * state when the registered server object adapters are activated. + * + **/ + Activating, + + /** + * + * The server is running. + * + **/ + Active, + + /** + * + * The server is being deactivated. + * + **/ + Deactivating, + + /** + * + * The server is being destroyed. + * + **/ + Destroying, + + /** + * + * The server is destroyed. + * + **/ + Destroyed +}; + +/** + * + * Dynamic information about the state of a server. + * + **/ struct ServerDynamicInfo { + /** + * + * The id of the server. + * + **/ string id; + + /** + * + * The state of the server. + * + **/ ServerState state; + + /** + * + * The process id of the server. + * + **/ int pid; }; + +/** + * + * A sequence of server dynamic information structures. + * + **/ sequence<ServerDynamicInfo> ServerDynamicInfoSeq; +/** + * + * Dynamic information about the state of an adapter. + * + **/ struct AdapterDynamicInfo { + /** + * + * The id of the adapter. + * + **/ string id; + + /** + * + * The id of the server this adapter belongs to. + * + **/ string serverId; + + /** + * + * The direct proxy containing the adapter endpoints. + * + **/ Object* proxy; }; + +/** + * + * A sequence of adapter dynamic information structures. + * + **/ sequence<AdapterDynamicInfo> AdapterDynamicInfoSeq; +/** + * + * Dynamic information about the state of a node. + * + **/ struct NodeDynamicInfo { string name; ServerDynamicInfoSeq servers; AdapterDynamicInfoSeq adapters; }; + +/** + * + * A sequence of node dynamic information structures. + * + **/ sequence<NodeDynamicInfo> NodeDynamicInfoSeq; +/** + * + * The node observer interface. Observers should implement this + * interface to receive information about the state of the IceGrid + * nodes. + * + **/ interface NodeObserver { + /** + * + * The init method is called after the registration of the + * observer to communicate the current state of the node to the + * observer implementation. + * + * @param nodes The current state of the nodes. + * + **/ ["ami"] void init(NodeDynamicInfoSeq nodes); + /** + * + * The nodeUp method is called to notify the observer that a node + * came up. + * + * @param node The node state. + * + **/ void nodeUp(NodeDynamicInfo node); + /** + * + * The nodeDown method is called to notify the observer that a node + * went down. + * + * @param name The node name. + * + **/ void nodeDown(string name); + /** + * + * The updateServer method is called to notify the observer that + * the state of a server changed. + * + * @param node The node hosting the server. + * + * @param updatedInfo The new server state. + * + **/ void updateServer(string node, ServerDynamicInfo updatedInfo); + /** + * + * The updateAdapter method is called to notify the observer that + * the state of an adapter changed. + * + * @param node The node hosting the adapter. + * + * @param updatedInfo The new adapter state. + * + **/ void updateAdapter(string node, AdapterDynamicInfo updatedInfo); }; +/** + * + * The registry observer interface. Observers should implement this + * interface to receive information about the state of the IceGrid + * registry. + * + **/ interface RegistryObserver { + /** + * + * The init method is called after the registration of the + * observer to communicate the current state of the registry to the + * observer implementation. + * + * @param serial The current serial of the registry database. This + * serial allows observers to make sure that their internal state + * is synchronized with the registry. + * + * @param applications The applications currently registered with + * the registry. + * + **/ ["ami"] void init(int serial, ApplicationDescriptorSeq applications); + /** + * + * The applicationAdded method is called to notify the observer + * that an application was added. + * + * @param serial The new serial number of the registry database. + * + * @param desc The descriptor of the new application. + * + **/ void applicationAdded(int serial, ApplicationDescriptor desc); + + /** + * + * The applicationRemoved method is called to notify the observer + * that an application was removed. + * + * @param serial The new serial number of the registry database. + * + * @param name The name of the application that was removed. + * + **/ void applicationRemoved(int serial, string name); + + /** + * + * The applicationUpdated method is called to notify the observer + * that an application was updated. + * + * @param serial The new serial number of the registry database. + * + * @param desc The descriptor of the update. + * + **/ void applicationUpdated(int serial, ApplicationUpdateDescriptor desc); }; @@ -91,7 +314,7 @@ interface Session extends Glacier2::Session * Set the identities of the observer objects that will receive * notifications from the servers when the state of the registry * or nodes changes. This method should be used by clients which - * are using a bi-directional connection to communicator with the + * are using a bi-directional connection to communicate with the * session. * * @param registryObs The registry observer identity. diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 89b4b6d9260..d140a009698 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -469,9 +469,9 @@ Database::getAllNodes(const string& expression) } ServerInfo -Database::getServerInfo(const std::string& name) +Database::getServerInfo(const std::string& id) { - return _serverCache.get(name)->getServerInfo(); + return _serverCache.get(id)->getServerInfo(); } ServerPrx diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 7d7549681a0..9fdee887dea 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -1476,7 +1476,7 @@ NodeHelper::diff(const NodeHelper& helper) const update.name = _name; if(_definition.loadFactor != helper._definition.loadFactor) { - update.loadFactor = new BoxedLoadFactor(_definition.loadFactor); + update.loadFactor = new BoxedString(_definition.loadFactor); } update.variables = getDictUpdatedElts(helper._definition.variables, _definition.variables); @@ -1882,7 +1882,7 @@ ApplicationHelper::diff(const ApplicationHelper& helper) update.name = _definition.name; if(_definition.description != helper._definition.description) { - update.description = new BoxedDescription(_definition.description); + update.description = new BoxedString(_definition.description); } update.variables = getDictUpdatedElts(helper._definition.variables, _definition.variables); @@ -1919,7 +1919,7 @@ ApplicationHelper::diff(const ApplicationHelper& helper) nodeUpdate.variables = node.variables; nodeUpdate.servers = node.servers; nodeUpdate.serverInstances = node.serverInstances; - nodeUpdate.loadFactor = new BoxedLoadFactor(node.loadFactor); + nodeUpdate.loadFactor = new BoxedString(node.loadFactor); update.nodes.push_back(nodeUpdate); } else diff --git a/cpp/test/IceGrid/update/AllTests.cpp b/cpp/test/IceGrid/update/AllTests.cpp index 8b3d0155f78..79d7bf3b1f5 100644 --- a/cpp/test/IceGrid/update/AllTests.cpp +++ b/cpp/test/IceGrid/update/AllTests.cpp @@ -674,7 +674,7 @@ allTests(const Ice::CommunicatorPtr& communicator) testApp = admin->getApplicationDescriptor("TestApp"); test(testApp.description == "Description"); - update.description = new BoxedDescription("updatedDescription"); + update.description = new BoxedString("updatedDescription"); try { admin->updateApplication(update); @@ -687,7 +687,7 @@ allTests(const Ice::CommunicatorPtr& communicator) testApp = admin->getApplicationDescriptor("TestApp"); test(testApp.description == "updatedDescription"); - update.description = new BoxedDescription(""); + update.description = new BoxedString(""); try { admin->updateApplication(update); |