Пример #1
0
        public NodeReader CreateIndexReader(long keyId)
        {
            NodeReader reader;

            if (!_indexReaders.TryGetValue(keyId, out reader))
            {
                lock (_syncIndexReaderCreation)
                {
                    if (!_indexReaders.TryGetValue(keyId, out reader))
                    {
                        var ixFileName  = Path.Combine(SessionFactory.Dir, string.Format("{0}.{1}.ix", CollectionId, keyId));
                        var ixpFileName = Path.Combine(SessionFactory.Dir, string.Format("{0}.{1}.ixp", CollectionId, keyId));
                        var vecFileName = Path.Combine(SessionFactory.Dir, string.Format("{0}.vec", CollectionId));

                        reader = new NodeReader(ixFileName, ixpFileName, vecFileName, SessionFactory, _config);

                        _indexReaders.GetOrAdd(keyId, reader);

                        this.Log("created index reader for {0}", ixFileName);
                    }
                }
            }

            return(reader);
        }
Пример #2
0
        public NodeReader CreateDocumentIndexReader(long keyId)
        {
            NodeReader reader;

            if (!_indexReaders.TryGetValue(keyId, out reader))
            {
                var ixFileName  = Path.Combine(SessionFactory.Dir, string.Format("{0}.{1}.ix1", CollectionId, keyId));
                var ixpFileName = Path.Combine(SessionFactory.Dir, string.Format("{0}.{1}.ixp1", CollectionId, keyId));
                var vecFileName = Path.Combine(SessionFactory.Dir, string.Format("{0}.vec1", CollectionId));

                reader = new NodeReader(ixFileName, ixpFileName, vecFileName, SessionFactory, _config);

                _indexReaders.GetOrAdd(keyId, reader);
            }

            return(reader);
        }