Exemplo n.º 1
0
        internal void AddObject(int IndexID, IIndex <T> index, Oid obj, QueryParameters queryParameters)
        {
            IndexData indexStorage = IndexStorageManager.IndexStorageManager <T> .GetIndexData(IndexID);

            try
            {
                DateTime  indexStart      = DateTime.Now;
                IndexData newIndexStorage = index.AddObject(indexStorage ?? index.EmptyIndexData, obj, queryParameters);
                IndexManager.IndexManager <T> .GetInstance().includeInStatistics(IndexID,
                                                                                 IndexCostInformation.OneObjectIndexAdd,
                                                                                 (float)
                                                                                 (DateTime.Now.Ticks - indexStart.Ticks) /
                                                                                 10000000);

                IndexStorageManager.IndexStorageManager <T> .UpdateIndexData(IndexID, newIndexStorage);
            }
            catch (Exception ex)
            {
                if (MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger() != null)
                {
                    MUTDOD.Server.Common.IndexMechanism.IndexMechanism <T> .GetLoger()
                    .Log("IndexMechanism", string.Format("Index {0} throwed exception\n{1}", index.GetType(), ex),
                         MessageLevel.Error);
                }
                throw ex;
            }
        }
Exemplo n.º 2
0
        internal void AddObjects(int IndexID, IIndex index, Oid[] obj, String[] attributes)
        {
            IndexData indexStorage = IndexStorageManager.IndexStorageManager.GetIndexData(IndexID);

            try
            {
                foreach (Oid oid in obj)
                {
                    DateTime indexStart = DateTime.Now;
                    indexStorage = index.AddObject(indexStorage ?? index.EmptyIndexData, oid, attributes);
                    IndexManager.IndexManager.GetInstance().includeInStatistics(IndexID,
                                                                                IndexCostInformation.OneObjectIndexAdd,
                                                                                (float)
                                                                                (DateTime.Now.Ticks - indexStart.Ticks) /
                                                                                10000000);
                }
            }
            catch (Exception ex)
            {
                if (MUTDOD.Server.Common.IndexMechanism.IndexMechanism.GetLoger() != null)
                {
                    MUTDOD.Server.Common.IndexMechanism.IndexMechanism.GetLoger()
                    .Log("IndexMechanism", string.Format("Index {0} throwed exception\n{1}", index.GetType(), ex),
                         MessageLevel.Error);
                }
                throw ex;
            }
            IndexStorageManager.IndexStorageManager.UpdateIndexData(IndexID, indexStorage);
        }