コード例 #1
0
        public List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup)
        {
            IntersectionQuery intersectionQuery;
            List <IPrimaryRelayMessageQuery> queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IntersectionQueryParams> > > clusterParamsMapping;

            IndexCacheUtils.SplitIndexIdsByCluster(IndexIdList, PrimaryIdList, intersectionQueryParamsMapping, numClustersInGroup, out clusterParamsMapping);

            if (clusterParamsMapping.Count == 1)
            {
                //This means that the query is not spilt across more than multiple clusters and the MaxResultItems criteria can be applied on the server
                IsSingleClusterQuery = true;
            }

            foreach (KeyValuePair <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IntersectionQueryParams> > > clusterParam in clusterParamsMapping)
            {
                intersectionQuery = new IntersectionQuery(this)
                {
                    primaryId     = clusterParam.Key,
                    IndexIdList   = clusterParam.Value.First,
                    PrimaryIdList = clusterParam.Value.Second,
                    intersectionQueryParamsMapping = clusterParam.Value.Third
                };
                queryList.Add(intersectionQuery);
            }
            return(queryList);
        }
コード例 #2
0
ファイル: Condition.cs プロジェクト: wilson0x4d/DataRelay
        public override string ToString()
        {
            var stb = new StringBuilder();

            stb.Append("(").Append(FieldName).Append(" ");
            stb.Append(Operation);
            int oper = (int)Operation;

            stb.Append(" ");
            if ((oper <= (int)Operation.BitwiseXOR))
            {
                stb.Append((Value == null)
                               ? "Null"
                               : (IndexCacheUtils.GetReadableByteArray(Value) + " [" + DataType + "]"));
            }
            else
            {
                stb.Append(ShiftBy);
            }

            if (oper > (int)Operation.NotEquals && oper != (int)Operation.BitwiseComplement)
            {
                stb.Append(" == ").Append((ExpectedBitwiseResult == null) ? "Null" : IndexCacheUtils.GetReadableByteArray(ExpectedBitwiseResult));
            }

            stb.Append(")");
            return(stb.ToString());
        }
コード例 #3
0
        public virtual List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup,
                                                                   int localClusterPosition,
                                                                   out IPrimaryRelayMessageQuery localQuery)
        {
            BaseMultiIndexIdQuery <TQueryResult> query;

            List <IPrimaryRelayMessageQuery> queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int /*cluster number*/, Triple <List <byte[]>, List <int>, Dictionary <byte[], IndexIdParams> > > clusterParamsMapping;

            localQuery = null;

            IndexCacheUtils.SplitIndexIdsByCluster(
                IndexIdList,
                PrimaryIdList,
                IndexIdParamsMapping,
                numClustersInGroup,
                out clusterParamsMapping);

            int mappingClusterCount = clusterParamsMapping.Count;
            int queryCount          = 0;

            ClientSideSubsetProcessingRequired =
                (numClustersInGroup > 1 && IndexIdList.Count > 1 && mappingClusterCount > 1);

            Triple <List <byte[]> /*index id list*/, List <int> /*primary id list*/, Dictionary <byte[], IndexIdParams> /*index id parms*/> value;

            for (int i = 0; i < numClustersInGroup; i++)
            {
                if (clusterParamsMapping.TryGetValue(i, out value) == false)
                {
                    continue;
                }

                query = (BaseMultiIndexIdQuery <TQueryResult>)Clone();

                query.PrimaryId            = i;
                query.IndexIdList          = value.First;
                query.PrimaryIdList        = value.Second;
                query.IndexIdParamsMapping = value.Third;
                query.ExcludeData          = true;      // dont retrieve data in these split queries for now

                if (query.PrimaryId == localClusterPosition)
                {
                    localQuery = query;
                }
                else
                {
                    queryList.Add(query);
                }

                if (++queryCount == mappingClusterCount)
                {
                    break;
                }
            }

            return(queryList);
        }
コード例 #4
0
ファイル: FilterCap.cs プロジェクト: wilson0x4d/DataRelay
        public override string ToString()
        {
            var stb = new StringBuilder();

            stb.Append("(").Append("FieldValue: ").Append(IndexCacheUtils.GetReadableByteArray(FieldValue)).Append("),");
            stb.Append("(").Append("UseParentFilter: ").Append(UseParentFilter).Append("),");
            stb.Append("(").Append("Filter: ").Append(Filter == null ? "Null" : Filter.ToString()).Append("),");
            stb.Append("(").Append("Cap: ").Append(Cap).Append("),");
            return(stb.ToString());
        }
コード例 #5
0
        public override string ToString()
        {
            var stb = new StringBuilder();

            stb.Append("(").Append("InclusiveMaxValue: ").Append(IndexCacheUtils.GetReadableByteArray(InclusiveMaxValue)).Append("),");
            stb.Append("(").Append("InclusiveMinValue: ").Append(IndexCacheUtils.GetReadableByteArray(InclusiveMinValue)).Append("),");
            stb.Append("(").Append("InclusiveMaxMetadataProperty: ").Append(InclusiveMaxMetadataProperty).Append("),");
            stb.Append("(").Append("InclusiveMaxMetadataPropertyDataType: ").Append(InclusiveMaxMetadataPropertyDataType.ToString()).Append("),");
            stb.Append("(").Append("InclusiveMinMetadataProperty: ").Append(InclusiveMinMetadataProperty).Append("),");
            stb.Append("(").Append("InclusiveMinMetadataPropertyDataType: ").Append(InclusiveMinMetadataPropertyDataType.ToString()).Append("),");
            return(stb.ToString());
        }
コード例 #6
0
        public List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup)
        {
            IntersectionQuery intersectionQuery;
            List <IPrimaryRelayMessageQuery> queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IntersectionQueryParams> > > clusterParamsMapping;

            IndexCacheUtils.SplitIndexIdsByCluster(indexIdList, primaryIdList, intersectionQueryParamsMapping, numClustersInGroup, out clusterParamsMapping);

            foreach (KeyValuePair <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IntersectionQueryParams> > > clusterParam in clusterParamsMapping)
            {
                intersectionQuery = new IntersectionQuery(this)
                {
                    primaryId     = clusterParam.Key,
                    indexIdList   = clusterParam.Value.First,
                    primaryIdList = clusterParam.Value.Second,
                    intersectionQueryParamsMapping = clusterParam.Value.Third
                };
                queryList.Add(intersectionQuery);
            }
            return(queryList);
        }
コード例 #7
0
        public List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup)
        {
            BaseMultiIndexContainsQuery <TQueryResult> multiIndexContainsQuery;
            List <IPrimaryRelayMessageQuery>           queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], MultiIndexContainsQueryParams> > > clusterParamsMapping;

            IndexCacheUtils.SplitIndexIdsByCluster(IndexIdList, PrimaryIdList, MultiIndexContainsQueryParamsMapping, numClustersInGroup, out clusterParamsMapping);

            foreach (KeyValuePair <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], MultiIndexContainsQueryParams> > > clusterParam in clusterParamsMapping)
            {
                multiIndexContainsQuery = new BaseMultiIndexContainsQuery <TQueryResult>(this)
                {
                    PrimaryId     = clusterParam.Key,
                    IndexIdList   = clusterParam.Value.First,
                    PrimaryIdList = clusterParam.Value.Second,
                    MultiIndexContainsQueryParamsMapping = clusterParam.Value.Third
                };
                queryList.Add(multiIndexContainsQuery);
            }
            return(queryList);
        }
コード例 #8
0
        public virtual List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup)
        {
            BaseMultiIndexIdQuery <TQueryResult> query;

            List <IPrimaryRelayMessageQuery> queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int /*cluster number*/, Triple <List <byte[]>, List <int>, Dictionary <byte[], IndexIdParams> > > clusterParamsMapping;

            IndexCacheUtils.SplitIndexIdsByCluster(IndexIdList,
                                                   PrimaryIdList,
                                                   IndexIdParamsMapping,
                                                   numClustersInGroup,
                                                   out clusterParamsMapping);

            int mappingClusterCount = clusterParamsMapping.Count;

            ClientSideSubsetProcessingRequired =
                (numClustersInGroup > 1 && IndexIdList.Count > 1 && mappingClusterCount > 1);

            Triple <List <byte[]> /*index id list*/, List <int> /*Primary id list*/, Dictionary <byte[], IndexIdParams> /*IndexId Params Mapping*/> value;

            for (int i = 0; i < numClustersInGroup && queryList.Count < mappingClusterCount; i++)
            {
                if (clusterParamsMapping.TryGetValue(i, out value) == false)
                {
                    continue;
                }

                query = (BaseMultiIndexIdQuery <TQueryResult>)Clone();

                query.PrimaryId            = i;
                query.IndexIdList          = value.First;
                query.PrimaryIdList        = value.Second;
                query.IndexIdParamsMapping = value.Third;

                queryList.Add(query);
            }

            return(queryList);
        }
コード例 #9
0
        public override List <IPrimaryRelayMessageQuery> SplitQuery(int numClustersInGroup)
        {
            SpanQuery query;
            List <IPrimaryRelayMessageQuery> queryList = new List <IPrimaryRelayMessageQuery>();
            Dictionary <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IndexIdParams> > > clusterParamsMapping;

            IndexCacheUtils.SplitIndexIdsByCluster(IndexIdList, PrimaryIdList, IndexIdParamsMapping, numClustersInGroup, out clusterParamsMapping);

            ClientSideSubsetProcessingRequired = (numClustersInGroup > 1 && IndexIdList.Count > 1 && clusterParamsMapping.Count > 1);

            foreach (KeyValuePair <int, Triple <List <byte[]>, List <int>, Dictionary <byte[], IndexIdParams> > > clusterParam in clusterParamsMapping)
            {
                query = new SpanQuery(this)
                {
                    PrimaryId            = clusterParam.Key,
                    IndexIdList          = clusterParam.Value.First,
                    PrimaryIdList        = clusterParam.Value.Second,
                    IndexIdParamsMapping = clusterParam.Value.Third,
                };
                queryList.Add(query);
            }
            return(queryList);
        }
コード例 #10
0
        public override string ToString()
        {
            var stb = new StringBuilder();

            stb.Append("(").Append("TargetIndexName: ").Append(TargetIndexName).Append("),");

            stb.Append("(").Append("TagsFromIndexes Count: ").Append(TagsFromIndexes == null ? "Null" : TagsFromIndexes.Count.ToString());
            if (TagsFromIndexes != null && TagsFromIndexes.Count > 0)
            {
                foreach (var indexName in TagsFromIndexes)
                {
                    stb.Append("(").Append(" IndexName: ").Append(indexName).Append("),");
                }
            }
            stb.Append("),");

            stb.Append("(").Append("TagSort: ").Append(TagSort == null ? "Null" : TagSort.ToString()).Append("),");

            stb.Append("(").Append("IndexIdList Count: ").Append(IndexIdList == null ? "Null" : IndexIdList.Count.ToString());
            if (IndexIdList != null && IndexIdList.Count > 0)
            {
                foreach (var indexId in IndexIdList)
                {
                    stb.Append("(").Append(" IndexId: ").Append(IndexCacheUtils.GetReadableByteArray(indexId)).Append("),");
                }
            }
            stb.Append("),");

            stb.Append("(").Append("MaxItems: ").Append(MaxItems).Append("),");

            stb.Append("(").Append("ExcludeData: ").Append(ExcludeData).Append("),");

            stb.Append("(").Append("GetIndexHeader: ").Append(GetIndexHeader).Append("),");

            stb.Append("(").Append("GetAdditionalAvailableItemCount: ").Append(GetAdditionalAvailableItemCount).Append("),");

            stb.Append("(").Append("PrimaryIdList").Append(PrimaryIdList == null ? "Null" : PrimaryIdList.Count.ToString());
            if (PrimaryIdList != null && PrimaryIdList.Count > 0)
            {
                foreach (var primaryId in PrimaryIdList)
                {
                    stb.Append("(").Append("PrimaryId: ").Append(primaryId).Append("),");
                }
            }
            stb.Append("),");

            if (Filter == null)
            {
                stb.Append("(").Append("Total Filter Count: ").Append(0);
            }
            else
            {
                stb.Append("(").Append("Total Filter Count: ").Append(Filter.FilterCount).Append(" ").Append("Filter Info - ").Append(Filter.ToString());
            }
            stb.Append("),");
            stb.Append("(").Append("IndexCondition: ").Append(IndexCondition == null ? "Null" : IndexCondition.ToString()).Append("),");
            stb.Append("(").Append("IndexIdParamsMapping Count: ").Append(IndexIdParamsMapping == null ? "Null" : IndexIdParamsMapping.Count.ToString());
            if (IndexIdParamsMapping != null && IndexIdParamsMapping.Count > 0)
            {
                foreach (var indexIdParam in IndexIdParamsMapping)
                {
                    stb.Append("(");
                    stb.Append("(").Append(" IndexId: ").Append(IndexCacheUtils.GetReadableByteArray(indexIdParam.Key)).Append("),");
                    stb.Append("(").Append("IndexIdParams: ").Append(indexIdParam.Value).Append("),");
                    stb.Append("),");
                }
            }
            stb.Append("),");
            stb.Append("(").Append("CapCondition: ").Append(CapCondition == null ? "Null" : CapCondition.ToString()).Append("),");
            stb.Append("(").Append("GetIndexHeaderType: ").Append(GetIndexHeaderType.ToString()).Append("),");
            stb.Append("(").Append("ClientSideSubsetProcessingRequired: ").Append(ClientSideSubsetProcessingRequired).Append("),");
            stb.Append("(").Append("MaxMergeCount: ").Append(MaxMergeCount).Append("),");
            stb.Append("(").Append("DomainSpecificProcessingType: ").Append(DomainSpecificProcessingType).Append("),");
            stb.Append("(").Append("GroupBy: ").Append(GroupBy == null ? "Null" : GroupBy.ToString()).Append("),");

            return(stb.ToString());
        }