/// <summary> /// The AddExplicitIndexOrReuse /// </summary> /// <param name="unique">The <see cref="bool"/></param> /// <param name="hashProps">The <see cref="IList{IndexedPropDesc}"/></param> /// <param name="btreeProps">The <see cref="IList{IndexedPropDesc}"/></param> /// <param name="advancedIndexProvisionDesc">The <see cref="EventAdvancedIndexProvisionDesc"/></param> /// <param name="prefilledEvents">The <see cref="IEnumerable{EventBean}"/></param> /// <param name="indexedType">The <see cref="EventType"/></param> /// <param name="indexName">The <see cref="string"/></param> /// <param name="agentInstanceContext">The <see cref="AgentInstanceContext"/></param> /// <param name="optionalSerde">The <see cref="object"/></param> /// <returns>The <see cref="Pair{IndexMultiKey, EventTableAndNamePair}"/></returns> public Pair <IndexMultiKey, EventTableAndNamePair> AddExplicitIndexOrReuse( bool unique, IList <IndexedPropDesc> hashProps, IList <IndexedPropDesc> btreeProps, EventAdvancedIndexProvisionDesc advancedIndexProvisionDesc, IEnumerable <EventBean> prefilledEvents, EventType indexedType, string indexName, AgentInstanceContext agentInstanceContext, object optionalSerde) { if (hashProps.IsEmpty() && btreeProps.IsEmpty() && advancedIndexProvisionDesc == null) { throw new ArgumentException("Invalid zero element list for hash and btree columns"); } // Get an existing table, if any, matching the exact requirement var indexPropKeyMatch = EventTableIndexUtil.FindExactMatchNameAndType(_tableIndexesRefCount.Keys, unique, hashProps, btreeProps, advancedIndexProvisionDesc == null ? null : advancedIndexProvisionDesc.IndexDesc); if (indexPropKeyMatch != null) { EventTableIndexRepositoryEntry refTablePair = _tableIndexesRefCount.Get(indexPropKeyMatch); return(new Pair <IndexMultiKey, EventTableAndNamePair>(indexPropKeyMatch, new EventTableAndNamePair(refTablePair.Table, refTablePair.OptionalIndexName))); } return(AddIndex(unique, hashProps, btreeProps, advancedIndexProvisionDesc, prefilledEvents, indexedType, indexName, false, agentInstanceContext, optionalSerde)); }
/// <summary> /// The GetIndexByDesc /// </summary> /// <param name="indexKey">The <see cref="IndexMultiKey"/></param> /// <returns>The <see cref="EventTable"/></returns> public EventTable GetIndexByDesc(IndexMultiKey indexKey) { EventTableIndexRepositoryEntry entry = _tableIndexesRefCount.Get(indexKey); if (entry == null) { return(null); } return(entry.Table); }
/// <summary> /// The RemoveIndex /// </summary> /// <param name="index">The <see cref="IndexMultiKey"/></param> public void RemoveIndex(IndexMultiKey index) { EventTableIndexRepositoryEntry entry = _tableIndexesRefCount.Delete(index); if (entry != null) { _tables.Remove(entry.Table); if (entry.OptionalIndexName != null) { _explicitIndexes.Remove(entry.OptionalIndexName); } entry.Table.Destroy(); } }
public void AddIndex(IndexMultiKey indexMultiKey, EventTableIndexRepositoryEntry entry) { _tableIndexesRefCount.Put(indexMultiKey, entry); _tables.Add(entry.Table); }