コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Force close old readers. </summary>
        ///
        /// <remarks>   Semantika d.o.o.,. </remarks>
        ///
        /// <param name="indexType">  (Optional) Type of the index. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public void ForceCloseOldReaders(IndexType?indexType = null)
        {
            IEnumerable <IndexType> typesToProcess = GetIndexTypesArray(indexType);

            m_searcherCache.Clear();

            foreach (var curType in typesToProcess)
            {
                var curManagementObjects = m_managementObjects[curType];
                //Perform cleanup of all potentialy open old readers / writers
                foreach (var readerToClose in curManagementObjects.OldReaders.Keys)
                {
                    try
                    {
                        readerToClose.Dispose();
                    }
                    catch (Exception)
                    {
                        //Nothing to do if we cannot close the reader
                    }
                }

                //Clear all of the old readers
                curManagementObjects.OldReaders.Clear();
            }
        }
        public AccelerationStructureGeometryTrianglesDataKHR
        (
            StructureType?sType = StructureType.AccelerationStructureGeometryTrianglesDataKhr,
            void *pNext         = null,
            Format?vertexFormat = null,
            DeviceOrHostAddressConstKHR?vertexData = null,
            ulong?vertexStride  = null,
            uint?maxVertex      = null,
            IndexType?indexType = null,
            DeviceOrHostAddressConstKHR?indexData     = null,
            DeviceOrHostAddressConstKHR?transformData = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (vertexFormat is not null)
            {
                VertexFormat = vertexFormat.Value;
            }

            if (vertexData is not null)
            {
                VertexData = vertexData.Value;
            }

            if (vertexStride is not null)
            {
                VertexStride = vertexStride.Value;
            }

            if (maxVertex is not null)
            {
                MaxVertex = maxVertex.Value;
            }

            if (indexType is not null)
            {
                IndexType = indexType.Value;
            }

            if (indexData is not null)
            {
                IndexData = indexData.Value;
            }

            if (transformData is not null)
            {
                TransformData = transformData.Value;
            }
        }
コード例 #3
0
        public Property(XmlNode node)
        {
            Name = node.Name;

            var typeStr = GetValue(node, "Type");

            Type = BaseType.AllTypes.Find(e => e.TypeName() == typeStr);
            if (Type == null)
            {
                Type = node.SelectSingleNode("Type").GetIType();
                if (Type == null)
                {
                    throw new ArgumentException(string.Format("Unknown type '{0}'", typeStr));
                }
            }

            Default = GetValue(node, "Default");

            var utypeStr = GetValue(node, "Utype");

            if (!string.IsNullOrEmpty(utypeStr))
            {
                Utype = UInt16.Parse(utypeStr);
            }

            var flagsStr = GetValue(node, "Flags");

            if (!string.IsNullOrEmpty(flagsStr))
            {
                Flags = (Flags)Enum.Parse(typeof(Flags), flagsStr);
            }

            var persistentStr = GetValue(node, "Persistent");

            if (!string.IsNullOrEmpty(persistentStr))
            {
                Persistent = bool.Parse(persistentStr);
            }

            var databaseLengthStr = GetValue(node, "DatabaseLength");

            if (!string.IsNullOrEmpty(databaseLengthStr))
            {
                DatabaseLength = uint.Parse(databaseLengthStr);
            }

            var indexTypeStr = GetValue(node, "Index");

            if (!string.IsNullOrEmpty(indexTypeStr))
            {
                IndexType = (IndexType)Enum.Parse(typeof(IndexType), indexTypeStr);
            }
        }
コード例 #4
0
        public AccelerationStructureCreateGeometryTypeInfoKHR
        (
            StructureType?sType          = StructureType.AccelerationStructureCreateGeometryTypeInfoKhr,
            void *pNext                  = null,
            GeometryTypeKHR?geometryType = null,
            uint?maxPrimitiveCount       = null,
            IndexType?indexType          = null,
            uint?maxVertexCount          = null,
            Format?vertexFormat          = null,
            Bool32?allowsTransforms      = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (geometryType is not null)
            {
                GeometryType = geometryType.Value;
            }

            if (maxPrimitiveCount is not null)
            {
                MaxPrimitiveCount = maxPrimitiveCount.Value;
            }

            if (indexType is not null)
            {
                IndexType = indexType.Value;
            }

            if (maxVertexCount is not null)
            {
                MaxVertexCount = maxVertexCount.Value;
            }

            if (vertexFormat is not null)
            {
                VertexFormat = vertexFormat.Value;
            }

            if (allowsTransforms is not null)
            {
                AllowsTransforms = allowsTransforms.Value;
            }
        }
コード例 #5
0
        //public static void InitElasticSearchIndex()
        //{
        //    InitElasticSearchIndex(defaultIndexName);
        //}
        public static void InitElasticSearchIndex(ElasticClient client, IndexType?idxType)
        {
            if (idxType == null)
            {
                return;
            }
            if (idxType.Value == IndexType.DataSource)
            {
                return;
            }
            var ret = client.IndexExists(client.ConnectionSettings.DefaultIndex);

            if (ret.Exists == false)
            {
                CreateIndex(client, idxType.Value);
            }
        }
コード例 #6
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Optimize the indexes by merging segments. </summary>
        ///
        /// <remarks>   Semantika d.o.o.,. </remarks>
        ///
        /// <param name="indexType">  (Optional) Type of the index. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public void TryOptimize(IndexType?indexType = null)
        {
            if (IsReadOnly)
            {
                throw new InvalidOperationException("Index is read only!");
            }
            IEnumerable <IndexType> typesToProcess = GetIndexTypesArray(indexType);

            Parallel.ForEach(typesToProcess, curType =>
            {
                var curManagementObjects = m_managementObjects[curType];
                if (curManagementObjects.Writer != null && !curManagementObjects.Writer.IsClosed)
                {
                    curManagementObjects.Writer.MaybeMerge();
                    curManagementObjects.Writer.Commit();
                }
            });
        }
コード例 #7
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Commit any uncommited data for all index writers and flush data to underlying storage
        /// subsystem.
        /// </summary>
        ///
        /// <remarks>   Semantika d.o.o.,. </remarks>
        ///
        /// <param name="indexType">  (Optional) Type of the index. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        public void Commit(IndexType?indexType = null)
        {
            if (IsReadOnly)
            {
                return;
            }

            IEnumerable <IndexType> typesToProcess = GetIndexTypesArray(indexType);

            Parallel.ForEach(typesToProcess, curType =>
            {
                var curManagementObjects = m_managementObjects[curType];
                if (curManagementObjects.Writer != null && !curManagementObjects.Writer.IsClosed)
                {
                    curManagementObjects.Writer.Commit();
                    curManagementObjects.Writer.Flush(true, true);
                }
            });
        }
コード例 #8
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// The monitor object for call synchronization of all methods that operate over same objects on
        /// the file I/O level.
        /// </summary>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        //private readonly object m_indexIOLock = new object();

        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Gets the index types arrays in this collection. </summary>
        ///
        /// <remarks>   Semantika d.o.o.,. </remarks>
        ///
        /// <param name="indexType">  (Optional) Type of the index. </param>
        ///
        /// <returns>
        /// An enumerator that allows foreach to be used to process the index types arrays in this
        /// collection.
        /// </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private IEnumerable <IndexType> GetIndexTypesArray(IndexType?indexType = null)
        {
            IEnumerable <IndexType> typesToOpen;

            if (indexType == null)
            {
                typesToOpen = m_indexTypes;
            }
            else
            {
                var tmpIndexType = indexType.Value;
                if (m_indexingMode == IndexingMode.SingleIndex)
                {
                    tmpIndexType.Language = m_singleIndexLangConstant;
                }
                typesToOpen = new IndexType[] { tmpIndexType };
            }

            return(typesToOpen);
        }
コード例 #9
0
        public BindIndexBufferIndirectCommandNV
        (
            ulong?bufferAddress = null,
            uint?size           = null,
            IndexType?indexType = null
        ) : this()
        {
            if (bufferAddress is not null)
            {
                BufferAddress = bufferAddress.Value;
            }

            if (size is not null)
            {
                Size = size.Value;
            }

            if (indexType is not null)
            {
                IndexType = indexType.Value;
            }
        }
コード例 #10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Ensures that open writer. </summary>
        ///
        /// <remarks>   Semantika d.o.o.,. </remarks>
        ///
        /// <param name="recreateIndex">  (Optional) True to recreate index. </param>
        /// <param name="indexType">      (Optional) Type of the index. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private void EnsureOpenWriter(bool recreateIndex = false, IndexType?indexType = null)
        {
            if (IsReadOnly)
            {
                throw new InvalidOperationException("The Index has been open as read only!");
            }

            //If we get the type of index we need, we open just that type, otherwise we open all supported types
            IEnumerable <IndexType> typesToOpen = GetIndexTypesArray(indexType);

            //lock (m_indexIOLock)
            {
                //Go through al lrequested index types
                foreach (var currentIndexType in typesToOpen)
                {
                    var currentManagementObjects = m_managementObjects[currentIndexType];

                    //Create writer instances
                    if (currentManagementObjects.Writer == null || currentManagementObjects.Writer.IsClosed)
                    {
                        //Configure the basic index configuration to use the main analyzer, and commit everything on close
                        IndexWriterConfig iwic = new IndexWriterConfig(LuceneVersion.LUCENE_48, new StandardAnalyzer(LuceneVersion.LUCENE_48));
                        if (recreateIndex)
                        {
                            iwic.SetOpenMode(OpenMode.CREATE);
                        }
                        else
                        {
                            iwic.SetOpenMode(OpenMode.CREATE_OR_APPEND);
                        }
                        iwic.SetMaxThreadStates(12);
                        currentManagementObjects.Writer = new IndexWriter(currentManagementObjects.Directory, iwic);
                    }
                }
            }
        }
コード例 #11
0
        public static ElasticClient GetESClient(string indexName, int timeOut = 60000, int connectionLimit = 80, IndexType?idxType = null)
        {
            lock (_clientLock)
            {
                if (idxType == IndexType.DataSource)
                {
                    indexName = dataSourceIndexNamePrefix + indexName;
                }

                string             cnnset = string.Format("{0}|{1}|{2}", indexName, timeOut, connectionLimit);
                ConnectionSettings sett   = GetElasticSearchConnectionSettings(indexName, timeOut, connectionLimit);
                if (!_clients.ContainsKey(cnnset))
                {
                    //if (idxType.HasValue == false)
                    //    idxType = GetIndexTypeForDefaultIndexName(indexName);
                    var _client = new ElasticClient(sett);
                    InitElasticSearchIndex(_client, idxType);

                    _clients.Add(cnnset, _client);
                }
                return(_clients[cnnset]);
            }
        }
コード例 #12
0
        public GeometryTrianglesNV
        (
            StructureType?sType   = StructureType.GeometryTrianglesNV,
            void *pNext           = null,
            Buffer?vertexData     = null,
            ulong?vertexOffset    = null,
            uint?vertexCount      = null,
            ulong?vertexStride    = null,
            Format?vertexFormat   = null,
            Buffer?indexData      = null,
            ulong?indexOffset     = null,
            uint?indexCount       = null,
            IndexType?indexType   = null,
            Buffer?transformData  = null,
            ulong?transformOffset = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (vertexData is not null)
            {
                VertexData = vertexData.Value;
            }

            if (vertexOffset is not null)
            {
                VertexOffset = vertexOffset.Value;
            }

            if (vertexCount is not null)
            {
                VertexCount = vertexCount.Value;
            }

            if (vertexStride is not null)
            {
                VertexStride = vertexStride.Value;
            }

            if (vertexFormat is not null)
            {
                VertexFormat = vertexFormat.Value;
            }

            if (indexData is not null)
            {
                IndexData = indexData.Value;
            }

            if (indexOffset is not null)
            {
                IndexOffset = indexOffset.Value;
            }

            if (indexCount is not null)
            {
                IndexCount = indexCount.Value;
            }

            if (indexType is not null)
            {
                IndexType = indexType.Value;
            }

            if (transformData is not null)
            {
                TransformData = transformData.Value;
            }

            if (transformOffset is not null)
            {
                TransformOffset = transformOffset.Value;
            }
        }
コード例 #13
0
ファイル: Manager.cs プロジェクト: HlidacStatu/HlidacStatu
        public static ElasticClient GetESClient(string indexName, int timeOut = 60000, int connectionLimit = 80, IndexType?idxType = null, bool init = true)
        {
            lock (_clientLock)
            {
                if (idxType == IndexType.DataSource)
                {
                    indexName = dataSourceIndexNamePrefix + indexName;
                }
                else if (indexName == defaultIndexName_Audit)
                {
                    //audit_Year-weekInYear
                    DateTime d = DateTime.Now;
                    indexName = $"{indexName}_{d.Year}-{System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(d, CalendarWeekRule.FirstDay, DayOfWeek.Monday)}";
                }
                string             cnnset = string.Format("{0}|{1}|{2}", indexName, timeOut, connectionLimit);
                ConnectionSettings sett   = GetElasticSearchConnectionSettings(indexName, timeOut, connectionLimit);
                if (!_clients.ContainsKey(cnnset))
                {
                    //if (idxType.HasValue == false)
                    //    idxType = GetIndexTypeForDefaultIndexName(indexName);

                    var _client = new ElasticClient(sett);
                    if (init)
                    {
                        InitElasticSearchIndex(_client, idxType);
                    }

                    _clients.Add(cnnset, _client);
                }
                return(_clients[cnnset]);
            }
        }