Exemplo n.º 1
0
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
		{
			if (reader.ReadBoolean())
			{
				int groupsCount = reader.ReadInt32();
				ErrorQueues = new Dictionary<string, Dictionary<string, MessageQueue>>(groupsCount);
				for (int i = 0; i < groupsCount; i++)
				{
					string group = reader.ReadString();
					if(reader.ReadBoolean())
					{
						int serviceCount = reader.ReadInt32();
						Dictionary<string, MessageQueue> groupQueues = new Dictionary<string, MessageQueue>(serviceCount);
						for (int j = 0; j < serviceCount; j++)
						{
							string serviceName = reader.ReadString();
							groupQueues.Add(serviceName, reader.Read<MessageQueue>());
						}
						ErrorQueues.Add(group, groupQueues);
					}					
				}
			}
		}
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
			this.cacheListId = reader.ReadBytes(reader.ReadInt32());

			int count = reader.ReadInt32();

            if (version >= 2)
            {
                if (count > 0)
                {
                    this.cacheListNodeIds = new byte[count][];
                    DeserializeListV2(reader, count);
                }
                this.VirtualListCount = reader.ReadInt32();
                if (version >= 3)
                    this.PrimaryId = reader.ReadInt32();
            }
            else
            {
                if (count > 0)
                {
                    this.cacheListNodeIds = new byte[count][];
                    DeserializeListV1(reader, count);
                }
            }
        }
        private static List<CacheListNode> DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int count)
        {
            List<CacheListNode> list = new List<CacheListNode>();
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    list.Add(new CacheListNode(
                        reader.ReadBytes(reader.ReadInt32()),					// nodeId						
                        reader.ReadBytes(reader.ReadInt32()),					// data
                        reader.ReadInt32()));	// timestamp
                }
            }

            return list;
        }
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
			this.ContainsCacheListNode = reader.ReadBoolean();
			this.ListExists = reader.ReadBoolean();
			this.ListMetadata = reader.ReadBytes(reader.ReadInt32());
			this.CacheListTotalCount = reader.ReadInt32();
			int count = reader.ReadInt32();

            if (version >= 2)
            {
                this.CacheList = DeserializeListV2(reader, count);
                this.VirtualListCount = reader.ReadInt32();
            }
            else
            {
                this.CacheList = DeserializeListV1(reader, count);
            }
        }
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
		{
            //IndexExists
            indexExists = reader.ReadBoolean();

            //IndexSize
            indexSize = reader.ReadInt32();

            //Metadata
            ushort len = reader.ReadUInt16();
            if (len > 0)
            {
                metadata = reader.ReadBytes(len);
            }

            //ResultItemList
            int listCount = reader.ReadInt32();
            resultItemList = new List<ResultItem>(listCount);
            if (listCount > 0)
            {
                ResultItem resultItem;
                for (int i = 0; i < listCount; i++)
                {
                    resultItem = new ResultItem();
                    resultItem.Deserialize(reader);
                    resultItemList.Add(resultItem);
                }
            }

            //ExceptionInfo
            exceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                virtualCount = reader.ReadInt32();
            }
		}
Exemplo n.º 6
0
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
		{
			indexId = reader.ReadBytes(reader.ReadInt32());
			cacheDataList = DeserializeList(reader, indexId);
			cacheDataDeleteList = DeserializeList(reader, indexId);
		}
Exemplo n.º 7
0
		private static List<CacheData> DeserializeList(MySpace.Common.IO.IPrimitiveReader reader, byte[] indexId)
		{			
			int count = reader.ReadInt32();
			List<CacheData> list = new List<CacheData>();
			if (count > 0)
			{
				for (int i = 0; i < count; i++)
				{
					list.Add(new CacheData(
						indexId, 
						reader.ReadBytes(reader.ReadInt32()), 
						reader.ReadBytes(reader.ReadInt32()), 
						new SmallDateTime(reader.ReadInt32()).FullDateTime,
						reader.ReadInt32() ));
				}
			}

			return list;
		}
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
		{
			this.totalCount = reader.ReadInt32();
			int count = reader.ReadInt32();
			cacheDataList = new List<CacheData>(count);
			if (count > 0)
			{
				int IndexIdLen = reader.ReadInt32();
				int IdLen = reader.ReadInt32();
				
				for (int i = 0; i < count; i++)
				{					
					cacheDataList.Add(
						new CacheData(
							reader.ReadBytes(IndexIdLen),							// IndexId
							reader.ReadBytes(IdLen),								// Id
							reader.ReadBytes(reader.ReadInt32()),					// Data
							new SmallDateTime(reader.ReadInt32()).FullDateTime,		// CreateTimeStamp
							reader.ReadInt32()));									// CacheTypeId
				}
			}			
		}
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
			this.CacheListId = reader.ReadBytes(reader.ReadInt32());
			this.CacheListNodeId = reader.ReadBytes(reader.ReadInt32());
			if(version>=2)
				this.virtualListCount = reader.ReadInt32();
            if (version >= 3)
                this.PrimaryId = reader.ReadInt32();
        }
Exemplo n.º 10
0
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
		{
            this.ListId = reader.ReadBytes(reader.ReadInt32());
            this.TTLSeconds = reader.ReadDouble();
            this.UpdateListMetadata = reader.ReadBoolean();
            this.ListMetadata = reader.ReadBytes(reader.ReadInt32());
			this.addList = DeserializeList(reader);
			this.deleteList = DeserializeList(reader);

            if (version >= 2)
                this.ClearList = reader.ReadBoolean();

            if (version >= 3)
                this.ReplaceList = reader.ReadBoolean();

            if (version >= 4)
                this.VirtualListCount = reader.ReadInt32();

            if (version >= 5)
                this.PrimaryId = reader.ReadInt32();
		}
Exemplo n.º 11
0
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
		{
			int Count = reader.ReadInt32();
			if (Count > 0)
			{
				data = reader.ReadBytes(Count);
			}
		}
 private void DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int numExcludedIds)
 {
     //support variable size node id length
     for (int i = 0; i < numExcludedIds; i++)
     {
         this.excludedIds[i] = reader.ReadBytes(reader.ReadInt32());
     }
 }
 private void DeserializeListV1(MySpace.Common.IO.IPrimitiveReader reader, int numExcludedIds)
 {
     //support fixed size node id length
     int idLength = reader.ReadInt32();
     for (int i = 0; i < numExcludedIds; i++)
     {
         this.excludedIds[i] = reader.ReadBytes(idLength);
     }
 }
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
			this.cacheListId = reader.ReadBytes(reader.ReadInt32());
			this.startIndex = reader.ReadInt32();
			this.count = reader.ReadInt32();
			int numExcludedIds = reader.ReadInt32();

            if (version >= 2)
            {
                if (numExcludedIds > 0)
                {
                    this.excludedIds = new byte[numExcludedIds][];
                    DeserializeListV2(reader, numExcludedIds);
                }
                this.VirtualListCount = reader.ReadInt32();
                if (version >= 3)
                    this.PrimaryId = reader.ReadInt32();
            }
            else
            {
                if (numExcludedIds > 0)
                {
                    this.excludedIds = new byte[numExcludedIds][];
                    DeserializeListV1(reader, numExcludedIds);
                }
            }
        }
 private void DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int count)
 {
     for (int i = 0; i < count; i++)
     {
         this.cacheListNodeIds[i] = reader.ReadBytes(reader.ReadInt32());
     }
 }
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
			this.CacheListId = reader.ReadBytes(reader.ReadInt32());
			this.PageSize = reader.ReadInt32();
			this.PageNum = reader.ReadInt32();
			this.ReversePagedQuery = reader.ReadBoolean();
			if(version>=2)
				this.VirtualListCount = reader.ReadInt32();
            if (version >= 3)
                this.PrimaryId = reader.ReadInt32();
        }
Exemplo n.º 17
0
		public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
		{
			//TODO figure out if this reverses the order of the queue
			_enabled = reader.ReadBoolean();
			_maxCount = reader.ReadInt32();
			_itemsPerDequeue = reader.ReadInt32();
			if (reader.ReadBoolean())
			{
				int count = reader.ReadInt32();
				_inMessageQueue = new Queue<SerializedRelayMessage>(count);
				for (int i = 0; i < count; i++)
				{
					_inMessageQueue.Enqueue(reader.Read<SerializedRelayMessage>());
				}
			}
		}