예제 #1
0
        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);
                }
            }
        }
예제 #2
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();
            }
        }
        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);
            }

            //FirstPageResultItemList
            int listCount = reader.ReadInt32();

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

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

            //ExceptionInfo
            exceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                virtualCount = reader.ReadInt32();
            }
        }
 public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
 {
     this.CacheListId = reader.ReadBytes(reader.ReadInt32());
     this.Count       = reader.ReadInt32();
     if (version >= 2)
     {
         this.VirtualListCount = reader.ReadInt32();
     }
     if (version >= 3)
     {
         this.PrimaryId = reader.ReadInt32();
     }
 }
예제 #5
0
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
        {
            totalCount = reader.ReadInt32();

            int resultListCount = reader.ReadInt32();

            if (resultListCount > 0)
            {
                for (int i = 0; i < resultListCount; i++)
                {
                    TItem cdr = new TItem();
                    cdr.Deserialize(reader);
                    resultList.Add(cdr);
                }
            }

            ushort resultMetadataCount = reader.ReadUInt16();

            if (resultMetadataCount > 0)
            {
                byte[] key;
                byte[] value;
                ushort keyLength;
                ushort valueLength;

                for (int i = 0; i < resultMetadataCount; i++)
                {
                    key = value = null;

                    keyLength = reader.ReadUInt16();
                    if (keyLength > 0)
                    {
                        key = reader.ReadBytes(keyLength);
                    }

                    valueLength = reader.ReadUInt16();
                    if (valueLength > 0)
                    {
                        value = reader.ReadBytes(valueLength);
                    }

                    if (key != null)
                    {
                        resultMetadata.Add(key, value);
                    }
                }
            }

            sortDescriptor         = reader.ReadString();
            cacheDataReferenceType = (CacheDataReferenceTypes)reader.ReadByte();
        }
 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>());
         }
     }
 }
예제 #7
0
 private void DeserializeListV2(MySpace.Common.IO.IPrimitiveReader reader, int count)
 {
     for (int i = 0; i < count; i++)
     {
         this.cacheListNodeIds[i] = reader.ReadBytes(reader.ReadInt32());
     }
 }
 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());
     }
 }
예제 #9
0
        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);
        }
예제 #10
0
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
        {
            //Skip byte
            reader.ReadByte();

            ushort indexIdLength = reader.ReadUInt16();

            if (indexIdLength > 0)
            {
                indexId = reader.ReadBytes(indexIdLength);
            }

            int count = reader.ReadInt32();

            if (count > 0)
            {
                TItem cdr = new TItem();
                for (int i = 0; i < count; i++)
                {
                    cdr.Deserialize(reader);
                    addList.Add(cdr);
                }
            }

            ushort metadataLength = reader.ReadUInt16();

            if (metadataLength > 0)
            {
                metadata = reader.ReadBytes(metadataLength);
            }

            count = reader.ReadInt32();
            if (count > 0)
            {
                TItem cdr = new TItem();
                for (int i = 0; i < count; i++)
                {
                    cdr.Deserialize(reader);
                    deleteList.Add(cdr);
                }
            }

            updateMetadata   = reader.ReadBoolean();
            replaceFullIndex = reader.ReadBoolean();
        }
예제 #11
0
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
        {
            int Count = reader.ReadInt32();

            if (Count > 0)
            {
                data = reader.ReadBytes(Count);
            }
        }
예제 #12
0
        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);
            }
        }
        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);
            }
        }
예제 #14
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, 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);
                }
            }
        }
예제 #16
0
 public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
 {
     if (reader.ReadBoolean())
     {
         int groupsCount = reader.ReadInt32();
         ErrorQueues = new Dictionary <string, Dictionary <string, ErrorQueue> >(groupsCount);
         for (int i = 0; i < groupsCount; i++)
         {
             string group = reader.ReadString();
             if (reader.ReadBoolean())
             {
                 int serviceCount = reader.ReadInt32();
                 Dictionary <string, ErrorQueue> groupQueues = new Dictionary <string, ErrorQueue>(serviceCount);
                 for (int j = 0; j < serviceCount; j++)
                 {
                     string serviceName = reader.ReadString();
                     groupQueues.Add(serviceName, reader.Read <ErrorQueue>());
                 }
                 ErrorQueues.Add(group, groupQueues);
             }
         }
     }
 }
        public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
        {
            result.Deserialize(reader);

            ushort metadataLen = reader.ReadUInt16();

            if (metadataLen > 0)
            {
                metadata = reader.ReadBytes(metadataLen);
            }

            indexExists = reader.ReadBoolean();
            indexSize   = reader.ReadInt32();
        }
예제 #18
0
        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
                }
            }
        }
예제 #19
0
 public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
 {
     this.listId     = reader.ReadBytes(reader.ReadInt32());
     this.addList    = DeserializeList(reader);
     this.deleteList = DeserializeList(reader);
 }
예제 #20
0
 public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader)
 {
     indexId             = reader.ReadBytes(reader.ReadInt32());
     cacheDataList       = DeserializeList(reader, indexId);
     cacheDataDeleteList = DeserializeList(reader, indexId);
 }