public void Deserialize(IPrimitiveReader reader, int version) { using (reader.CreateRegion()) { //Filter byte b = reader.ReadByte(); if (b != 0) { FilterType filterType = (FilterType)b; filter = FilterFactory.CreateFilter(reader, filterType); } } }
/// <summary> /// Processes the filters. /// </summary> /// <param name="internalItem">The internal item.</param> /// <param name="filter">The filter.</param> /// <returns>if true Filter passed successfully; otherwise, false</returns> private bool FilterPassed(InternalItem internalItem, Filter filter) { bool retVal = true; if (filter != null) { if (!FilterUtil.ProcessFilter(internalItem, filter, InDeserializationContext.InclusiveFilter, InDeserializationContext.TagHashCollection)) { retVal = false; if (InDeserializationContext.CollectFilteredItems) { outDeserializationContext.FilteredInternalItemList.Add(internalItem); } } } return(retVal); }
public void Deserialize(IPrimitiveReader reader, int version) { using (reader.CreateRegion()) { //IndexId ushort len = reader.ReadUInt16(); if (len > 0) { indexId = reader.ReadBytes(len); } //Count count = reader.ReadInt32(); //TargetIndexName targetIndexName = reader.ReadString(); //ExcludeData excludeData = reader.ReadBoolean(); //GetMetadata getMetadata = reader.ReadBoolean(); //Filter byte b = reader.ReadByte(); if (b != 0) { FilterType filterType = (FilterType) b; filter = FilterFactory.CreateFilter(reader, filterType); } if (version >= 2) { //FullDataIdInfo fullDataIdInfo = new FullDataIdInfo(); Serializer.Deserialize(reader.BaseStream, fullDataIdInfo); } } }
private void Init(byte[] indexId, int count, string targetIndexName, bool excludeData, bool getMetadata, Filter filter, FullDataIdInfo fullDataIdInfo) { this.indexId = indexId; this.count = count; this.targetIndexName = targetIndexName; this.excludeData = excludeData; this.getMetadata = getMetadata; this.filter = filter; this.fullDataIdInfo = fullDataIdInfo; }
public RandomQuery(byte[] indexId, int count, string targetIndexName, bool excludeData, bool getMetadata, Filter filter) { Init(indexId, count, targetIndexName, excludeData, getMetadata, filter, null); }
/// <summary> /// Gets the CacheIndexInternal. /// </summary> /// <param name="storeContext">The store context.</param> /// <param name="typeId">The type id.</param> /// <param name="primaryId">The primary id.</param> /// <param name="indexId">The index id.</param> /// <param name="extendedIdSuffix">The extended id suffix.</param> /// <param name="indexName">Name of the index.</param> /// <param name="count">The count.</param> /// <param name="filter">The filter.</param> /// <param name="inclusiveFilter">if set to <c>true</c> includes the items that pass the filter; otherwise , <c>false</c>.</param> /// <param name="indexCondition">The index condition.</param> /// <param name="deserializeHeaderOnly">if set to <c>true</c> if just CacheIndexInternal header is to be deserialized; otherwise, <c>false</c>.</param> /// <param name="getFilteredItems">if set to <c>true</c> get filtered items; otherwise, <c>false</c>.</param> /// <param name="primarySortInfo">The primary sort info.</param> /// <param name="localIdentityTagNames">The local identity tag names.</param> /// <param name="stringHashCodeDictionary">The string hash code dictionary.</param> /// <param name="capCondition">The cap condition.</param> /// <returns>CacheIndexInternal</returns> internal static CacheIndexInternal GetCacheIndexInternal(IndexStoreContext storeContext, short typeId, int primaryId, byte[] indexId, short extendedIdSuffix, string indexName, int count, Filter filter, bool inclusiveFilter, IndexCondition indexCondition, bool deserializeHeaderOnly, bool getFilteredItems, PrimarySortInfo primarySortInfo, List<string> localIdentityTagNames, Dictionary<int, bool> stringHashCodeDictionary, CapCondition capCondition) { CacheIndexInternal cacheIndexInternal = null; byte[] extendedId = FormExtendedId(indexId, extendedIdSuffix); RelayMessage getMsg = new RelayMessage(typeId, primaryId, extendedId, MessageType.Get); storeContext.IndexStorageComponent.HandleMessage(getMsg); if (getMsg.Payload != null) //CacheIndex exists { cacheIndexInternal = new CacheIndexInternal { InDeserializationContext = new InDeserializationContext { TypeId = getMsg.TypeId, TagHashCollection = storeContext.TagHashCollection, IndexId = indexId, IndexName = indexName, MaxItemsPerIndex = count, Filter = filter, InclusiveFilter = inclusiveFilter, IndexCondition = indexCondition, DeserializeHeaderOnly = deserializeHeaderOnly, CollectFilteredItems = getFilteredItems, PrimarySortInfo = primarySortInfo, LocalIdentityTagNames = localIdentityTagNames, StringHashCollection = storeContext.StringHashCollection, StringHashCodeDictionary = stringHashCodeDictionary, CapCondition = capCondition } }; // This mess is required until Moods 2.0 migrated to have IVersionSerializable version of CacheIndexInternal // ** TBD - Should be removed later if (LegacySerializationUtil.Instance.IsSupported(getMsg.TypeId)) { MemoryStream stream = new MemoryStream(getMsg.Payload.ByteArray); cacheIndexInternal.Deserialize(new CompactBinaryReader(stream)); } else { getMsg.GetObject(cacheIndexInternal); } } return cacheIndexInternal; }
private void Init(int maxItems, Filter filter, IIndexIdParam baseQuery) { MaxItems = maxItems; Filter = filter; BaseQuery = baseQuery; }
public virtual void Deserialize(IPrimitiveReader reader, int version) { //TargetIndexName targetIndexName = reader.ReadString(); //IndexIdList ushort count = reader.ReadUInt16(); if (count > 0) { indexIdList = new List<byte[]>(count); ushort len; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); if (len > 0) { indexIdList.Add(reader.ReadBytes(len)); } } } //ExcludeData excludeData = reader.ReadBoolean(); //GetIndexHeader getIndexHeader = reader.ReadBoolean(); //PrimaryIdList count = reader.ReadUInt16(); if (count > 0) { primaryIdList = new List<int>(count); for (ushort i = 0; i < count; i++) { primaryIdList.Add(reader.ReadInt32()); } } //Filter byte b = reader.ReadByte(); if (b != 0) { FilterType filterType = (FilterType)b; filter = FilterFactory.CreateFilter(reader, filterType); } //IndexIdParamsMapping count = reader.ReadUInt16(); if (count > 0) { intersectionQueryParamsMapping = new Dictionary<byte[], IntersectionQueryParams>(count, new ByteArrayEqualityComparer()); byte[] indexId; IntersectionQueryParams intersectionQueryParam; ushort len; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); indexId = null; if (len > 0) { indexId = reader.ReadBytes(len); intersectionQueryParam = new IntersectionQueryParams(); Serializer.Deserialize(reader.BaseStream, intersectionQueryParam); intersectionQueryParamsMapping.Add(indexId, intersectionQueryParam); } } } if (version >= 2) { //FullDataIdInfo fullDataIdInfo = new FullDataIdInfo(); Serializer.Deserialize(reader.BaseStream, fullDataIdInfo); } }
private void Init(List<byte[]> indexIdList, List<int> primaryIdList, string targetIndexName, bool excludeData, bool getIndexHeader, Dictionary<byte[], IntersectionQueryParams> intersectionQueryParamsMapping, Filter filter, FullDataIdInfo fullDataIdInfo) { this.indexIdList = indexIdList; this.primaryIdList = primaryIdList; this.targetIndexName = targetIndexName; this.excludeData = excludeData; this.getIndexHeader = getIndexHeader; this.intersectionQueryParamsMapping = intersectionQueryParamsMapping; this.filter = filter; this.fullDataIdInfo = fullDataIdInfo; }
private void Init(byte[] indexId, string targetIndexName, Filter deleteFilter) { this.indexId = indexId; this.targetIndexName = targetIndexName; this.deleteFilter = deleteFilter; }
public FilteredIndexDeleteCommand(byte[] indexId, string targetIndexName, Filter deleteFilter) { Init(indexId, targetIndexName, deleteFilter); }
public override void Deserialize(IPrimitiveReader reader, int version) { using (reader.CreateRegion()) { //IndexId ushort len = reader.ReadUInt16(); if (len > 0) { indexId = reader.ReadBytes(len); } //TargetIndexName targetIndexName = reader.ReadString(); //DeleteFilter byte b = reader.ReadByte(); if (b != 0) { FilterType filterType = (FilterType)b; deleteFilter = FilterFactory.CreateFilter(reader, filterType); } } }
/// <summary> /// Processes the filters. /// </summary> /// <param name="internalItem">The internal item.</param> /// <param name="filter">The filter.</param> /// <returns>if true Filter passed successfully; otherwise, false</returns> private bool FilterPassed(InternalItem internalItem, Filter filter) { bool retVal = true; if (filter != null) { if (!FilterUtil.ProcessFilter(internalItem, filter, InDeserializationContext.InclusiveFilter, InDeserializationContext.TagHashCollection)) { retVal = false; if (InDeserializationContext.CollectFilteredItems) { outDeserializationContext.FilteredInternalItemList.Add(internalItem); } } } return retVal; }
private void Init(Filter filter, IntersectionQuery baseQuery) { this.filter = filter; this.baseQuery = baseQuery; }
public void Deserialize(IPrimitiveReader reader, int version) { //IndexId ushort len = reader.ReadUInt16(); if (len > 0) { indexId = reader.ReadBytes(len); } //FirstPageSize firstPageSize = reader.ReadInt32(); //LastPageSize lastPageSize = reader.ReadInt32(); //TargetIndexName targetIndexName = reader.ReadString(); //Read a byte to account for deprecated CriterionList reader.ReadByte(); //ExcludeData excludeData = reader.ReadBoolean(); //GetMetadata getMetadata = reader.ReadBoolean(); if (version >= 2) { //Filter byte b = reader.ReadByte(); if (b != 0) { FilterType filterType = (FilterType)b; filter = FilterFactory.CreateFilter(reader, filterType); } } if(version >= 3) { //FullDataIdInfo fullDataIdInfo = new FullDataIdInfo(); Serializer.Deserialize(reader.BaseStream, fullDataIdInfo); } }
public VirtualRandomQuery(byte[] indexId, int count, string targetIndexName, bool excludeData, bool getMetadata, Filter filter, string cacheTypeName) : base(indexId, count, targetIndexName, excludeData, getMetadata, filter) { Init(cacheTypeName); }