示例#1
0
        public WriteSession(
            ulong collectionId,
            LocalStorageSessionFactory sessionFactory,
            ITokenizer tokenizer) : base(collectionId, sessionFactory)
        {
            _tokenizer  = tokenizer;
            _log        = Logging.CreateLogWriter("writesession");
            _indexQueue = new ProducerConsumerQueue <IndexJob>(Write);
            _buildQueue = new ProducerConsumerQueue <BuildJob>(Write);

            ValueStream      = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", collectionId)));
            KeyStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", collectionId)));
            DocStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", collectionId)));
            ValueIndexStream = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", collectionId)));
            KeyIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", collectionId)));
            DocIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", collectionId)));
            PostingsStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.pos", collectionId)));
            VectorStream     = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vec", collectionId)));
            Index            = sessionFactory.GetCollectionIndex(collectionId);

            _vals           = new ValueWriter(ValueStream);
            _keys           = new ValueWriter(KeyStream);
            _docs           = new DocWriter(DocStream);
            _valIx          = new ValueIndexWriter(ValueIndexStream);
            _keyIx          = new ValueIndexWriter(KeyIndexStream);
            _docIx          = new DocIndexWriter(DocIndexStream);
            _postingsReader = new PagedPostingsReader(PostingsStream);
            _dirty          = new Dictionary <long, VectorNode>();
        }
示例#2
0
 public Writer(LocalStorageSessionFactory sessionFactory, ITokenizer analyzer)
 {
     _tokenizer      = analyzer;
     _sessionFactory = sessionFactory;
     _writeQueue     = new ProducerConsumerQueue <WriteJob>(ExecuteWrite);
     _log            = Logging.CreateLogWriter("writer");
     _itemTimer      = new Stopwatch();
     _batchTimer     = new Stopwatch();
 }
示例#3
0
        public DocumentReadSession(ulong collectionId, LocalStorageSessionFactory sessionFactory)
            : base(collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", collectionId)));
            KeyStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", collectionId)));
            DocStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", collectionId)));
            ValueIndexStream = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", collectionId)));
            KeyIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", collectionId)));
            DocIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", collectionId)));

            _docIx     = new DocIndexReader(DocIndexStream);
            _docs      = new DocReader(DocStream);
            _keyIx     = new ValueIndexReader(KeyIndexStream);
            _valIx     = new ValueIndexReader(ValueIndexStream);
            _keyReader = new ValueReader(KeyStream);
            _valReader = new ValueReader(ValueStream);
        }
示例#4
0
        public ReadSession(ulong collectionId, LocalStorageSessionFactory sessionFactory)
            : base(collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.ValueStream;
            KeyStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", collectionId)));
            DocStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", collectionId)));
            ValueIndexStream = sessionFactory.ValueIndexStream;
            KeyIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", collectionId)));
            DocIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", collectionId)));
            PostingsStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.pos", collectionId)));
            VectorStream     = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vec", collectionId)));
            Index            = sessionFactory.GetIndex(collectionId);

            _docIx          = new DocIndexReader(DocIndexStream);
            _docs           = new DocReader(DocStream);
            _keyIx          = new ValueIndexReader(KeyIndexStream);
            _valIx          = new ValueIndexReader(ValueIndexStream);
            _keyReader      = new ValueReader(KeyStream);
            _valReader      = new ValueReader(ValueStream);
            _postingsReader = new PagedPostingsReader(PostingsStream);
        }
示例#5
0
        public WriteSession(ulong collectionId, LocalStorageSessionFactory sessionFactory)
            : base(collectionId, sessionFactory)
        {
            _dirty = new Dictionary <long, VectorNode>();

            ValueStream      = sessionFactory.WritableValueStream;
            KeyStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", collectionId)));
            DocStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", collectionId)));
            ValueIndexStream = sessionFactory.WritableValueIndexStream;
            KeyIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", collectionId)));
            DocIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", collectionId)));
            PostingsStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.pos", collectionId)));
            VectorStream     = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vec", collectionId)));
            Index            = sessionFactory.GetIndex(collectionId);

            _vals           = new ValueWriter(ValueStream);
            _keys           = new ValueWriter(KeyStream);
            _docs           = new DocWriter(DocStream);
            _valIx          = new ValueIndexWriter(ValueIndexStream);
            _keyIx          = new ValueIndexWriter(KeyIndexStream);
            _docIx          = new DocIndexWriter(DocIndexStream);
            _postingsReader = new PagedPostingsReader(PostingsStream);
        }
示例#6
0
 public Reader(LocalStorageSessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory;
 }
 public Writer(LocalStorageSessionFactory sessionFactory, ITokenizer analyzer)
 {
     _tokenizer      = analyzer;
     _sessionFactory = sessionFactory;
     _writeQueue     = new ProducerConsumerQueue <WriteJob>(Commit);
 }
 public CollectionSession(ulong collectionId, LocalStorageSessionFactory sessionFactory)
 {
     SessionFactory = sessionFactory;
     CollectionId   = collectionId;
 }
示例#9
0
 public Reader(LocalStorageSessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory;
     _log            = Logging.CreateLogWriter("reader");
 }