Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

ICluster.d

Go to the documentation of this file.
00001 /*******************************************************************************
00002 
00003         @file ICluster.d
00004         
00005         Copyright (c) 2004 Kris Bell
00006         
00007         This software is provided 'as-is', without any express or implied
00008         warranty. In no event will the authors be held liable for damages
00009         of any kind arising from the use of this software.
00010         
00011         Permission is hereby granted to anyone to use this software for any 
00012         purpose, including commercial applications, and to alter it and/or 
00013         redistribute it freely, subject to the following restrictions:
00014         
00015         1. The origin of this software must not be misrepresented; you must 
00016            not claim that you wrote the original software. If you use this 
00017            software in a product, an acknowledgment within documentation of 
00018            said product would be appreciated but is not required.
00019 
00020         2. Altered source versions must be plainly marked as such, and must 
00021            not be misrepresented as being the original software.
00022 
00023         3. This notice may not be removed or altered from any distribution
00024            of the source.
00025 
00026         4. Derivative works are permitted, but they must carry this notice
00027            in full and credit the original source.
00028 
00029 
00030                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00031 
00032 
00033         @version        Initial version, July 2004      
00034         @author         Kris
00035 
00036 
00037 *******************************************************************************/
00038 
00039 module mango.cluster.model.ICluster;
00040 
00041 private import  mango.io.model.IPickle;
00042 
00043 public  import  mango.log.model.ILogger;
00044 
00045 public  import  mango.cache.model.IPayload;
00046 
00047 public  import  mango.cluster.model.IEvent,
00048                 mango.cluster.model.IChannel,
00049                 mango.cluster.model.IMessage,
00050                 mango.cluster.model.IConsumer;
00051 
00052 /*******************************************************************************
00053 
00054         The contract exposed by each QOS implementation. This is the heart
00055         of the cluster package, designed with multiple implementations in 
00056         mind. It should be reasonably straightforward to construct specific
00057         implementations upon a database, pub/sub system, or other substrates.
00058 
00059 *******************************************************************************/
00060 
00061 interface ICluster
00062 {
00063         /***********************************************************************
00064                 
00065                 Create a channel instance. Every cluster operation has
00066                 a channel provided as an argument
00067 
00068         ***********************************************************************/
00069         
00070         IChannel createChannel (char[] channel);
00071 
00072         /***********************************************************************
00073 
00074                 Scatter a payload to all registered listeners. This is
00075                 akin to multicast.
00076 
00077         ***********************************************************************/
00078         
00079         void broadcast (IChannel channel, IPayload payload = null);
00080 
00081         /***********************************************************************
00082 
00083                 Create a listener of the specified style on the given
00084                 channel. The IEventListener should be called whenever
00085                 a corresponding cluster event happens. Note that the
00086                 notification is expected to be on a seperate thread.
00087 
00088         ***********************************************************************/
00089         
00090         IConsumer createConsumer (IChannel channel, IEvent.Style style, 
00091                                   IEventListener notify);
00092 
00093         /***********************************************************************
00094 
00095                 Return a cluster cache entry, and optionally remove it
00096                 from the cluster.
00097 
00098         ***********************************************************************/
00099         
00100         IPayload getCache (IChannel channel, char[] key, bool remove);
00101 
00102         /***********************************************************************
00103 
00104                 Place a cache entry into the cluster. If there is already
00105                 a matching entry, it is replaced.
00106 
00107         ***********************************************************************/
00108         
00109         IPayload putCache (IChannel channel, char[] key, IPayload payload);
00110 
00111         /***********************************************************************
00112 
00113                 Place a new entry into the cluster queue. This may throw
00114                 a ClusterFullException when there is no space left within
00115                 the cluster queues.
00116 
00117         ***********************************************************************/
00118         
00119         IPayload putQueue (IChannel channel, IPayload payload);
00120 
00121         /***********************************************************************
00122                 
00123                 Query the cluster for queued entries on our corresponding 
00124                 channel. Returns, and removes, the first matching entry 
00125                 from the cluster.
00126 
00127         ***********************************************************************/
00128         
00129         IPayload getQueue (IChannel channel);
00130 
00131         /***********************************************************************
00132                 
00133         ***********************************************************************/
00134         
00135         void loadCache (IChannel channel, char[] key, IPayload payload);
00136 
00137         /***********************************************************************
00138 
00139                 Return the Logger associated with this cluster
00140 
00141         ***********************************************************************/
00142         
00143         ILogger getLogger ();
00144 }

Generated on Sat Dec 24 17:28:33 2005 for Mango by  doxygen 1.4.0