コード例 #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 void Dispose()
 {
     _ixStream.Dispose();
     _ixPageIndexWriter.Dispose();
 }