public EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent, ExprEvaluatorContext exprEvaluatorContext) { EventTableOrganization organization = Organization; return(new EventTable[] { new PropertyCompositeEventTableImpl( OptKeyCoercedTypes, OptRangeCoercedTypes, organization, (OptionalKeyedProps != null && OptionalKeyedProps.Count > 0), Chain) }); }
/// <summary>Ctor. </summary> public PropertySortedEventTable(EventPropertyGetter propertyGetter, EventTableOrganization organization) { _organization = organization; PropertyGetter = propertyGetter; PropertyIndex = new OrderedDictionary <Object, ISet <EventBean> >(); NullKeyedValues = new LinkedHashSet <EventBean>(); }
public override EventTable[] MakeEventTables() { var organization = new EventTableOrganization(null, false, true, StreamNum, new String[] { PropertyName }, EventTableOrganization.EventTableOrganizationType.BTREE); return(new EventTable[] { new PropertySortedEventTableCoerced(PropertyGetter, organization, _coercionType) }); }
public virtual EventTable[] MakeEventTables() { var organization = new EventTableOrganization(null, false, false, StreamNum, new String[] { PropertyName }, EventTableOrganization.EventTableOrganizationType.BTREE); return(new EventTable[] { new PropertySortedEventTable(PropertyGetter, organization) }); }
public override EventTable[] MakeEventTables() { var organization = new EventTableOrganization(OptionalIndexName, Unique, true, StreamNum, PropertyNames, EventTableOrganization.EventTableOrganizationType.HASH); return(new EventTable[] { new PropertyIndexedEventTableCoerceAdd(PropertyGetters, organization, Coercers, CoercionType) }); }
public override EventTable[] MakeEventTables() { var organization = new EventTableOrganization(OptionalIndexName, Unique, true, StreamNum, new String[] { PropertyName }, EventTableOrganization.EventTableOrganizationType.HASH); var eventTable = new PropertyIndexedEventTableSingleCoerceAll(PropertyGetter, organization, Coercer, CoercionType); return(new EventTable[] { eventTable }); }
public PropertyIndexedEventTableCoerceAdd( EventPropertyGetter[] propertyGetters, EventTableOrganization organization, Coercer[] coercers, Type[] coercionTypes) : base(propertyGetters, organization) { Coercers = coercers; CoercionTypes = coercionTypes; }
public EventTable[] MakeEventTables() { var organization = new EventTableOrganization(null, false, _optKeyCoercedTypes != null || _optRangeCoercedTypes != null, _streamNum, CombinedPropertyLists(_optionalKeyedProps, _rangeProps), EventTableOrganization.EventTableOrganizationType.COMPOSITE); return(new EventTable[] { new PropertyCompositeEventTable( (_optionalKeyedProps != null && _optionalKeyedProps.Count > 0), _chain, _optKeyCoercedTypes, _optRangeCoercedTypes, organization) }); }
public PropertyIndexedEventTableSingle(EventPropertyGetter propertyGetter, EventTableOrganization organization, bool allocate) { PropertyGetter = propertyGetter; _organization = organization; if (allocate) { PropertyIndex = new Dictionary <object, ISet <EventBean> >().WithNullSupport(); } else { PropertyIndex = null; } }
public virtual EventTable[] MakeEventTables() { var organization = new EventTableOrganization( OptionalIndexName, Unique, false, StreamNum, new String[] { PropertyName }, EventTableOrganization.EventTableOrganizationType.HASH); var eventTable = Unique ? new PropertyIndexedEventTableSingleUnique(PropertyGetter, organization) : new PropertyIndexedEventTableSingle(PropertyGetter, organization, true); return(new EventTable[] { eventTable }); }
public virtual EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent) { var organization = new EventTableOrganization(OptionalIndexName, Unique, false, StreamNum, new String[] { PropertyName }, EventTableOrganizationType.HASH); if (Unique) { return(new EventTable[] { new PropertyIndexedEventTableSingleUnique(PropertyGetter, organization) }); } else { return(new EventTable[] { new PropertyIndexedEventTableSingleUnadorned(PropertyGetter, organization) }); } }
public virtual EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent, ExprEvaluatorContext exprEvaluatorContext) { EventTableOrganization organization = Organization; if (unique) { return(new EventTable[] { new PropertyIndexedEventTableUnique(propertyGetters, organization) }); } else { return(new EventTable[] { new PropertyIndexedEventTableUnadorned(propertyGetters, organization) }); } }
public PropertyCompositeEventTable(bool isHashKeyed, CompositeIndexEnterRemove chain, IList <Type> optKeyCoercedTypes, IList <Type> optRangeCoercedTypes, EventTableOrganization organization) { _chain = chain; _optKeyCoercedTypes = optKeyCoercedTypes; _optRangeCoercedTypes = optRangeCoercedTypes; _organization = organization; if (isHashKeyed) { _index = new Dictionary <Object, Object>(); } else { _index = new OrderedDictionary <Object, Object>(); } }
public EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent) { var tables = new EventTable[PropertyGetters.Length]; if (Unique) { for (var i = 0; i < tables.Length; i++) { var organization = new EventTableOrganization(OptionalIndexName, Unique, false, StreamNum, new String[] { PropertyNames[i] }, EventTableOrganizationType.HASH); tables[i] = new PropertyIndexedEventTableSingleUnique(PropertyGetters[i], organization); } } else { for (var i = 0; i < tables.Length; i++) { var organization = new EventTableOrganization(OptionalIndexName, Unique, false, StreamNum, new String[] { PropertyNames[i] }, EventTableOrganizationType.HASH); tables[i] = new PropertyIndexedEventTableSingleUnadorned(PropertyGetters[i], organization); } } return(tables); }
public PropertyIndexedEventTable(EventPropertyGetter[] propertyGetters, EventTableOrganization organization) { PropertyGetters = propertyGetters; _organization = organization; PropertyIndex = new Dictionary <MultiKeyUntyped, ISet <EventBean> >(); }
public virtual EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent, ExprEvaluatorContext exprEvaluatorContext) { EventTableOrganization organization = Organization; return(new EventTable[] { new PropertySortedEventTableImpl(PropertyGetter, organization) }); }
public override EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent) { EventTableOrganization organization = GetOrganization(); return(new EventTable[] { new PropertyIndexedEventTableSingleCoerceAdd(PropertyGetter, organization, Coercer, CoercionType) }); }
protected PropertyIndexedEventTableSingle(EventPropertyGetter propertyGetter, EventTableOrganization organization) { this.propertyGetter = propertyGetter; this.organization = organization; }
public PropertyIndexedEventTableUnadorned(EventPropertyGetter[] propertyGetters, EventTableOrganization organization) : base(propertyGetters, organization) { propertyIndex = new Dictionary <MultiKeyUntyped, ISet <EventBean> >(); }
public override EventTable[] MakeEventTables(EventTableFactoryTableIdent tableIdent, ExprEvaluatorContext exprEvaluatorContext) { EventTableOrganization organization = Organization; return(new EventTable[] { new PropertyIndexedEventTableCoerceAdd(propertyGetters, organization, Coercers, CoercionType) }); }
public PropertyIndexedEventTableCoerceAll(EventPropertyGetter[] propertyGetters, EventTableOrganization organization, Coercer[] coercers, Type[] coercionType) : base(propertyGetters, organization, coercers, coercionType) { }
protected PropertyIndexedEventTable(EventPropertyGetter[] propertyGetters, EventTableOrganization organization) { this.propertyGetters = propertyGetters; this.organization = organization; }
protected PropertyCompositeEventTable(IList <Type> optKeyCoercedTypes, IList <Type> optRangeCoercedTypes, EventTableOrganization organization) { _optKeyCoercedTypes = optKeyCoercedTypes; _optRangeCoercedTypes = optRangeCoercedTypes; Organization = organization; }
public PropertyIndexedEventTableUnique(EventPropertyGetter[] propertyGetters, EventTableOrganization organization) : base(propertyGetters, organization) { _propertyIndex = new Dictionary <MultiKeyUntyped, EventBean>(); _canClear = true; }
public PropertyCompositeEventTableImpl(IList <Type> optKeyCoercedTypes, IList <Type> optRangeCoercedTypes, EventTableOrganization organization, bool isHashKeyed, CompositeIndexEnterRemove chain) : base(optKeyCoercedTypes, optRangeCoercedTypes, organization) { _chain = chain; _index = isHashKeyed ? (IDictionary <object, object>) new Dictionary <object, object>() : (IDictionary <object, object>) new OrderedDictionary <object, object>(); }
/// <summary> /// Ctor. /// </summary> /// <param name="tables">tables to hold</param> /// <param name="organization">The _organization.</param> public MultiIndexEventTable(EventTable[] tables, EventTableOrganization organization) { _tables = tables; _organization = organization; }
public SingleReferenceEventTable(EventTableOrganization organization, Atomic <ObjectArrayBackedEventBean> eventReference) { this._organization = organization; this._eventReference = eventReference; }
/// <summary>Get the strategies to use for polling from a given stream. </summary> /// <param name="streamViewStreamNum">the stream providing the polling events</param> /// <returns>looking and indexing strategy</returns> public Pair <HistoricalIndexLookupStrategy, PollResultIndexingStrategy> GetStrategy(int streamViewStreamNum) { // If there is only a single polling stream, then build a single index if (_pollingStreams.Count == 1) { return(JoinSetComposerPrototypeFactory.DetermineIndexing(_queryGraph, _typesPerStream[_historicalStreamNum], _typesPerStream[streamViewStreamNum], _historicalStreamNum, streamViewStreamNum)); } // If there are multiple polling streams, determine if a single index is appropriate. // An index can be reused if: // (a) indexed property names are the same // (b) indexed property types are the same // (c) key property types are the same (because of coercion) // A index lookup strategy is always specific to the providing stream. if (_indexesUsedByStreams == null) { _indexesUsedByStreams = new LinkedHashMap <HistoricalStreamIndexDesc, IList <int> >(); foreach (var pollingStream in _pollingStreams) { var queryGraphValue = _queryGraph.GetGraphValue(pollingStream, _historicalStreamNum); var hashKeyProps = queryGraphValue.HashKeyProps; var indexProperties = hashKeyProps.Indexed; var keyTypes = GetPropertyTypes(hashKeyProps.Keys); var indexTypes = GetPropertyTypes(_typesPerStream[_historicalStreamNum], indexProperties); var desc = new HistoricalStreamIndexDesc(indexProperties, indexTypes, keyTypes); var usedByStreams = _indexesUsedByStreams.Get(desc); if (usedByStreams == null) { usedByStreams = new List <int>(); _indexesUsedByStreams.Put(desc, usedByStreams); } usedByStreams.Add(pollingStream); } // There are multiple indexes required: // Build a master indexing strategy that forms multiple indexes and numbers each. if (_indexesUsedByStreams.Count > 1) { var numIndexes = _indexesUsedByStreams.Count; var indexingStrategies = new PollResultIndexingStrategy[numIndexes]; // create an indexing strategy for each index var count = 0; foreach (var desc in _indexesUsedByStreams) { var sampleStreamViewStreamNum = desc.Value[0]; indexingStrategies[count] = JoinSetComposerPrototypeFactory.DetermineIndexing(_queryGraph, _typesPerStream[_historicalStreamNum], _typesPerStream[sampleStreamViewStreamNum], _historicalStreamNum, sampleStreamViewStreamNum).Second; count++; } // create a master indexing strategy that utilizes each indexing strategy to create a set of indexes var streamNum = streamViewStreamNum; _masterIndexingStrategy = new ProxyPollResultIndexingStrategy { ProcIndex = (pollResult, isActiveCache, statementContext) => { var tables = new EventTable[numIndexes]; for (var i = 0; i < numIndexes; i++) { tables[i] = indexingStrategies[i].Index(pollResult, isActiveCache, statementContext)[0]; } var organization = new EventTableOrganization(null, false, false, streamNum, null, EventTableOrganizationType.MULTIINDEX); return(new EventTable[] { new MultiIndexEventTable(tables, organization) }); }, ProcToQueryPlan = () => { var writer = new StringWriter(); var delimiter = ""; foreach (var strategy in indexingStrategies) { writer.Write(delimiter); writer.Write(strategy.ToQueryPlan()); delimiter = ", "; } return(GetType().FullName + " " + writer); } }; } } // there is one type of index if (_indexesUsedByStreams.Count == 1) { return(JoinSetComposerPrototypeFactory.DetermineIndexing( _queryGraph, _typesPerStream[_historicalStreamNum], _typesPerStream[streamViewStreamNum], _historicalStreamNum, streamViewStreamNum)); } // determine which index number the polling stream must use var indexUsed = 0; var found = false; foreach (var desc in _indexesUsedByStreams.Values) { if (desc.Contains(streamViewStreamNum)) { found = true; break; } indexUsed++; } if (!found) { throw new IllegalStateException("MapIndex not found for use by stream " + streamViewStreamNum); } // Use one of the indexes built by the master index and a lookup strategy var indexNumber = indexUsed; HistoricalIndexLookupStrategy innerLookupStrategy = JoinSetComposerPrototypeFactory.DetermineIndexing(_queryGraph, _typesPerStream[_historicalStreamNum], _typesPerStream[streamViewStreamNum], _historicalStreamNum, streamViewStreamNum).First; var lookupStrategy = new ProxyHistoricalIndexLookupStrategy { ProcLookup = (lookupEvent, index, context) => { var multiIndex = (MultiIndexEventTable)index[0]; var indexToUse = multiIndex.Tables[indexNumber]; return(innerLookupStrategy.Lookup(lookupEvent, new EventTable[] { indexToUse }, context)); }, ProcToQueryPlan = () => GetType().FullName + " inner: " + innerLookupStrategy.ToQueryPlan() }; return(new Pair <HistoricalIndexLookupStrategy, PollResultIndexingStrategy> (lookupStrategy, _masterIndexingStrategy)); }
public PropertyIndexedEventTableUnique(EventPropertyGetter[] propertyGetters, EventTableOrganization organization, IDictionary <MultiKeyUntyped, EventBean> propertyIndex) : base(propertyGetters, organization) { _propertyIndex = propertyIndex; _canClear = false; }
public PropertyIndexedEventTableSingleCoerceAll(EventPropertyGetter propertyGetter, EventTableOrganization organization, Coercer coercer, Type coercionType) : base(propertyGetter, organization, coercer, coercionType) { _coercionType = coercionType; }