예제 #1
0
        public ColumnSerializer(ulong collectionId, long keyId, SessionFactory sessionFactory, RemotePostingsWriter postingsWriter = null, string ixFileExtension = "ix", string pageFileExtension = "ixp")
        {
            _keyId          = keyId;
            _collectionId   = collectionId;
            _postingsWriter = postingsWriter;
            _sessionFactory = sessionFactory;

            var pixFileName = Path.Combine(_sessionFactory.Dir, string.Format("{0}.{1}.{2}", _collectionId, keyId, pageFileExtension));
            var ixFileName  = Path.Combine(_sessionFactory.Dir, string.Format("{0}.{1}.{2}", _collectionId, keyId, ixFileExtension));

            try
            {
                _pageIndexWriter = new PageIndexWriter(_sessionFactory.CreateAppendStream(pixFileName));
                _ixStream        = _sessionFactory.CreateAppendStream(ixFileName);
            }
            catch (IOException)
            {
                Thread.Sleep(100);

                if (_pageIndexWriter != null)
                {
                    _pageIndexWriter.Dispose();
                }
                if (_ixStream != null)
                {
                    _ixStream.Dispose();
                }

                _pageIndexWriter = new PageIndexWriter(_sessionFactory.CreateAppendStream(pixFileName));
                _ixStream        = _sessionFactory.CreateAppendStream(ixFileName);
            }
        }
예제 #2
0
 public OptimizeSession(
     string collectionName,
     ulong collectionId,
     SessionFactory sessionFactory,
     IConfigurationProvider config,
     ConcurrentDictionary <long, NodeReader> indexReaders) : base(collectionName, collectionId, sessionFactory)
 {
     _config         = config;
     _readSession    = new ReadSession(collectionName, collectionId, sessionFactory, config, indexReaders);
     _postingsWriter = new RemotePostingsWriter(config, collectionName);
 }
예제 #3
0
        public ColumnSerializer(ulong collectionId, long keyId, SessionFactory sessionFactory, RemotePostingsWriter postingsWriter, string ixFileExtension = "ix", string pageFileExtension = "ixp")
        {
            _keyId          = keyId;
            _collectionId   = collectionId;
            _postingsWriter = postingsWriter;
            _sessionFactory = sessionFactory;

            var pixFileName = Path.Combine(_sessionFactory.Dir, string.Format("{0}.{1}.{2}", _collectionId, keyId, pageFileExtension));
            var ixFileName  = Path.Combine(_sessionFactory.Dir, string.Format("{0}.{1}.{2}", _collectionId, keyId, ixFileExtension));

            _ixPageIndexWriter = new PageIndexWriter(_sessionFactory.CreateAppendStream(pixFileName));
            _ixStream          = _sessionFactory.CreateAppendStream(ixFileName);
        }
예제 #4
0
        public IndexingSession(
            string collectionId,
            SessionFactory sessionFactory,
            ITokenizer tokenizer,
            IConfigurationService config) : base(collectionId, sessionFactory)
        {
            _tokenizer      = tokenizer;
            _log            = Logging.CreateWriter("indexingsession");
            _dirty          = new ConcurrentDictionary <long, VectorNode>();
            _postingsWriter = new RemotePostingsWriter(config);
            _timer          = new Stopwatch();
            _validate       = config.Get("create_index_validation_files") == "true";

            Index = sessionFactory.GetCollectionIndex(collectionId.ToHash()) ?? new SortedList <long, VectorNode>();
        }