Beispiel #1
0
        public VoronIndexOutput(
            TempFileCache fileCache,
            string name,
            Transaction tx,
            string tree,
            IndexOutputFilesSummary indexOutputFilesSummary)
        {
            _fileCache = fileCache;
            _name      = name;
            _tree      = tree;
            _tx        = tx;
            _indexOutputFilesSummary = indexOutputFilesSummary;

            _ms = fileCache.RentMemoryStream();
            _tx.ReadTree(_tree).AddStream(name, Stream.Null); // ensure it's visible by LuceneVoronDirectory.FileExists, the actual write is inside Dispose
        }
Beispiel #2
0
        public LuceneVoronDirectory(Transaction tx, StorageEnvironment environment, string name)
        {
            if (tx.IsWriteTransaction == false)
            {
                throw new InvalidOperationException($"Creation of the {nameof(LuceneVoronDirectory)} must be done under a write transaction.");
            }

            _environment = environment;
            _name        = name;

            SetLockFactory(NoLockFactory.Instance);

            tx.CreateTree(_name);

            _indexOutputFilesSummary = new IndexOutputFilesSummary();
        }
Beispiel #3
0
        public VoronIndexOutput(
            StorageEnvironmentOptions options,
            string name,
            Transaction tx,
            string tree,
            IndexOutputFilesSummary indexOutputFilesSummary)
        {
            _name                    = name;
            _tree                    = tree;
            _tx                      = tx;
            _fileTempPath            = options.TempPath.Combine(name + "_" + Guid.NewGuid()).FullPath;
            _indexOutputFilesSummary = indexOutputFilesSummary;

            _file = InitFileStream(options);

            _tx.ReadTree(_tree).AddStream(name, Stream.Null); // ensure it's visible by LuceneVoronDirectory.FileExists, the actual write is inside Dispose
        }
        public VoronIndexOutput(
            StorageEnvironmentOptions options,
            string name,
            Transaction tx,
            string tree,
            IndexOutputFilesSummary indexOutputFilesSummary)
        {
            _name                    = name;
            _tree                    = tree;
            _tx                      = tx;
            _fileTempPath            = options.TempPath.Combine(name + "_" + Guid.NewGuid()).FullPath;
            _indexOutputFilesSummary = indexOutputFilesSummary;

            if (options.EncryptionEnabled)
            {
                _file = new TempCryptoStream(_fileTempPath);
            }
            else
            {
                _file = SafeFileStream.Create(_fileTempPath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite, 4096, FileOptions.DeleteOnClose);
            }

            _tx.ReadTree(_tree).AddStream(name, Stream.Null); // ensure it's visible by LuceneVoronDirectory.FileExists, the actual write is inside Dispose
        }