[asterisk-scf-commits] asterisk-scf/integration/slice.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 22 19:53:05 CDT 2010


branch "master" has been updated
       via  7e495b0f6f1582eaff817de677ae3ce70fa721fb (commit)
      from  8dc5001dccdda7e4df38c2bb9175f2b8e058536e (commit)

Summary of changes:
 System/Component/CMakeLists.txt         |    1 +
 System/Component/ComponentServiceIf.ice |   12 ++--
 System/Component/ReplicaIf.ice          |  109 +++++++++++++++++++++++++++++++
 3 files changed, 115 insertions(+), 7 deletions(-)
 create mode 100644 System/Component/ReplicaIf.ice


- Log -----------------------------------------------------------------
commit 7e495b0f6f1582eaff817de677ae3ce70fa721fb
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Sep 22 22:19:48 2010 -0230

    Seems end of module comments in C++ style format cause problems for some
    of the other language parsers. I've replaced the ones in ComponentServiceIf.ice with
    C style "/* */" comments.
    
    Added an initial "replica management" interface.

diff --git a/System/Component/CMakeLists.txt b/System/Component/CMakeLists.txt
index fafe3e9..7dcb9af 100644
--- a/System/Component/CMakeLists.txt
+++ b/System/Component/CMakeLists.txt
@@ -1,2 +1,3 @@
 # Compile Component API 
 hydra_compile_slice(ComponentServiceIf.ice lib "ComponentService API" System)
+hydra_compile_slice(ReplicaIf.ice lib "ComponentService API" System)
diff --git a/System/Component/ComponentServiceIf.ice b/System/Component/ComponentServiceIf.ice
index c7b7f56..358850d 100644
--- a/System/Component/ComponentServiceIf.ice
+++ b/System/Component/ComponentServiceIf.ice
@@ -5,8 +5,8 @@
  *
  * All rights reserved.
  */
-
 #pragma once
+
 module AsteriskSCF
 {
 module System
@@ -63,9 +63,7 @@ module V1
        */
       void shutdown() throws Suspended;
    };
-
-}; // End of module V1
-}; // End of module Component
-}; // End of module System
-}; // End of module AsteriskSCF
-
+}; /*  End of V1 */
+}; /*  End of Component */
+}; /*  End of System */
+}; /*  End of AsteriskSCF */
diff --git a/System/Component/ReplicaIf.ice b/System/Component/ReplicaIf.ice
new file mode 100644
index 0000000..a8b9d4a
--- /dev/null
+++ b/System/Component/ReplicaIf.ice
@@ -0,0 +1,109 @@
+/*
+ * Asterisk Scalable Communications Framework
+ *
+ * Copyright (C) 2010 -- Digium, Inc.
+ *
+ * All rights reserved.
+ */
+
+#pragma once
+#include <System/Component/ComponentServiceIf.ice>
+
+module AsteriskSCF
+{
+module System
+{
+module Component
+{
+module V1
+{
+    interface ReplicaListener;
+    
+    /***
+     *
+     * Replica objects support operating as part of a collection either as
+     * active or standby replicas. The Replica interface supports querying
+     * the status of a replica and transitioning from active to standby and
+     * vice-versa.
+     *
+     */
+    interface Replica
+    {
+        /**
+         * active returns the active status of a replicant. If false, the replica is in
+         * standby mode.
+         * @return true if active, false if in standby mode.
+         */
+        bool active();
+
+        /**
+         * tells the replica object to transition from standby to active mode.
+         * Calling activate on a replica that is already active should have no effect.
+         */
+        bool activate();
+
+        /**
+         * standby tells the replica object to transition from active to standby mode.
+         * Calling standby on a replica that is already in standby mode should have
+         * no effect.
+         */
+        void standby();
+
+        /**
+         * addListener adds a ReplicaListener object that will receive notifications
+         * if the status of a replica changes.
+         *
+         * @param listener The ReplicaListener object to be added.
+         */
+        void addListener(ReplicaListener* listener);
+
+        /**
+         * removeListener removes a ReplicaListener object from the list of listeners
+         * receiving notificiatons of changes to the status of a replica.
+         *
+         * @param listener The ReplicaListener object to be removed.
+         */
+        void removeListener(ReplicaListener* listener);
+    };
+
+    /**
+     *
+     * ReplicaListener objects are registered with replicas to receive notifications
+     * of changes to a replica's status.
+     *
+     */
+    interface ReplicaListener
+    {
+        /**
+         * Called when a replica has moved from standby to active state.
+         *
+         * @param source The replica under transition.
+         */
+        void activated(Replica* source);
+        
+        /**
+         * Called when a replica has moved from active to standby state.
+         *
+         * @param source The replica under transition.
+         */
+        void onStandby(Replica* source);
+
+        /**
+         * A replica may periodically notify listeners of its state.
+         *
+         * @param source The replica producing the heartbeat.
+         * 
+         * @param isActive the current status of replica, true if active, false if on standby.
+         */
+        void heartbeat(Replica* source, bool isActive);
+
+        //
+        // NOTE:
+        // I briefly considered adding stuff like alarm notification and whatnot to this
+        // interface, but while worthwhile, I don't think they belong here.
+        //
+    };
+}; /* End of namespace V1 */
+}; /* End of namespace Component */
+}; /* End of namespace System */
+}; /* End of namespace AsteriskSCF */

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/slice.git



More information about the asterisk-scf-commits mailing list