Exemplo n.º 1
0
        /// <summary>
        /// Distributes the specified to other server nodes.
        /// </summary>
        /// <param name="msg">The MSG <see cref="IndexusMessage"/></param>
        public override void Distribute(IndexusMessage msg)
        {
            #region Access Log
#if TRACE
            {
                COM.Handler.LogHandler.Tracking("Access Method: " + this.GetType().ToString() + "->" + ((object)MethodBase.GetCurrentMethod()).ToString() + " ;");
            }
#endif
            #endregion Access Log

            // very important because if this is not set explizit to
            // server mode it will try to access wrong configuration providers
            msg.ClientContext = false;

            switch (msg.Action)
            {
            case IndexusMessage.ActionValue.Add:
                COM.CacheUtil.Add(msg);
                break;

            case IndexusMessage.ActionValue.Remove:
                COM.CacheUtil.Remove(msg);
                break;

            case IndexusMessage.ActionValue.Get:
            case IndexusMessage.ActionValue.GetAllKeys:
            case IndexusMessage.ActionValue.Statistic:
            case IndexusMessage.ActionValue.Error:
            case IndexusMessage.ActionValue.Successful:
            case IndexusMessage.ActionValue.Ping:
            case IndexusMessage.ActionValue.RemoveAll:
            case IndexusMessage.ActionValue.MultiAdd:
            case IndexusMessage.ActionValue.MultiDelete:
            case IndexusMessage.ActionValue.MultiGet:
            default:
                Handler.LogHandler.Fatal(string.Format("Distribute option '{0}' is not supported!!", msg.Action));
                                        #if DEBUG
                Console.WriteLine("Distribute option '{0}' is not supported!!", msg.Action);
                                        #endif
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Based on a list of key's the client receives a dictonary with
        /// all available data depending on the keys.
        /// </summary>
        /// <param name="keys">A List of <see cref="string"/> with all requested keys.</param>
        /// <param name="host">The host to request the key's from</param>
        /// <returns>
        /// A <see cref="IDictionary{TKey,TValue}"/> with <see cref="string"/> and <see cref="byte"/> array element.
        /// </returns>
        public override IDictionary <string, byte[]> MultiGet(List <string> keys, string host)
        {
            var result = new Dictionary <string, byte[]>();

            using (var msg = new IndexusMessage())
            {
                msg.Hostname = host;
                msg.Key      = "MultiGetKeyServerNode2ServerNode";
                msg.Action   = IndexusMessage.ActionValue.MultiGet;
                msg.Payload  = Formatters.Serialization.BinarySerialize(keys);
                if (CacheUtil.Get(msg) && msg.Payload != null)
                {
                    var partialResult = Formatters.Serialization.BinaryDeSerialize <IDictionary <string, byte[]> >(msg.Payload);

                    foreach (KeyValuePair <string, byte[]> item in partialResult)
                    {
                        result.Add(item.Key, item.Value);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Distributes the specified to other server nodes.
 /// </summary>
 /// <param name="msg">The MSG <see cref="IndexusMessage"/></param>
 public abstract void Distribute(IndexusMessage msg);
		/// <summary>
		/// Distributes the specified to other server nodes.
		/// </summary>
		/// <param name="msg">The MSG <see cref="IndexusMessage"/></param>
		public abstract void Distribute(IndexusMessage msg);