Skip to content

Commit

Permalink
Fix backward compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Sep 4, 2024
1 parent b2bde05 commit f7f8f4c
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Microsoft.Extensions.Options;

namespace Examine.Lucene.Directories
{
internal sealed class FakeLuceneDirectoryIndexOptionsOptionsMonitor : IOptionsMonitor<LuceneDirectoryIndexOptions>
{
private static readonly LuceneDirectoryIndexOptions s_default = new LuceneDirectoryIndexOptions();

public LuceneDirectoryIndexOptions CurrentValue => s_default;

public LuceneDirectoryIndexOptions Get(string name) => s_default;

public IDisposable OnChange(Action<LuceneDirectoryIndexOptions, string> listener) => throw new NotImplementedException();
}
}
9 changes: 9 additions & 0 deletions src/Examine.Lucene/Directories/FileSystemDirectoryFactory.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;
using Examine.Lucene.Providers;
using Lucene.Net.Index;
Expand All @@ -11,6 +12,14 @@ public class FileSystemDirectoryFactory : DirectoryFactoryBase
{
private readonly DirectoryInfo _baseDir;

[Obsolete("Use ctor with all dependencies")]
public FileSystemDirectoryFactory(
DirectoryInfo baseDir,
ILockFactory lockFactory)
: this (baseDir, lockFactory, new FakeLuceneDirectoryIndexOptionsOptionsMonitor())
{
}

public FileSystemDirectoryFactory(
DirectoryInfo baseDir,
ILockFactory lockFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Examine.Lucene.Directories
{
/// <summary>
/// A directory factory that replicates the index from main storage on initialization to another
/// directory, then creates a lucene Directory based on that replicated index.
/// directory, then creates a Lucene Directory based on that replicated index.
/// </summary>
/// <remarks>
/// A replication thread is spawned to then replicate the local index back to the main storage location.
Expand All @@ -30,6 +30,27 @@ public class SyncedFileSystemDirectoryFactory : FileSystemDirectoryFactory
private ExamineReplicator _replicator;
private Directory _mainLuceneDir;

[Obsolete("Use ctor with all dependencies")]
public SyncedFileSystemDirectoryFactory(
DirectoryInfo localDir,
DirectoryInfo mainDir,
ILockFactory lockFactory,
ILoggerFactory loggerFactory)
: this(localDir, mainDir, lockFactory, loggerFactory, new FakeLuceneDirectoryIndexOptionsOptionsMonitor(), false)
{
}

[Obsolete("Use ctor with all dependencies")]
public SyncedFileSystemDirectoryFactory(
DirectoryInfo localDir,
DirectoryInfo mainDir,
ILockFactory lockFactory,
ILoggerFactory loggerFactory,
bool tryFixMainIndexIfCorrupt)
: base(mainDir, lockFactory, new FakeLuceneDirectoryIndexOptionsOptionsMonitor())
{
}

public SyncedFileSystemDirectoryFactory(
DirectoryInfo localDir,
DirectoryInfo mainDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ namespace Examine.Lucene.Directories
/// </remarks>
public class TempEnvFileSystemDirectoryFactory : FileSystemDirectoryFactory
{
[Obsolete("Use ctor with all dependencies")]
public TempEnvFileSystemDirectoryFactory(
IApplicationIdentifier applicationIdentifier,
ILockFactory lockFactory)
: this(applicationIdentifier, lockFactory, new FakeLuceneDirectoryIndexOptionsOptionsMonitor())
{
}

public TempEnvFileSystemDirectoryFactory(
IApplicationIdentifier applicationIdentifier,
ILockFactory lockFactory,
Expand Down
1 change: 1 addition & 0 deletions src/Examine.Lucene/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Examine.Lucene.Directories.FileSystemDirectoryFactory.FileSystemDirectoryFactory(System.IO.DirectoryInfo baseDir, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Options.IOptionsMonitor<Examine.Lucene.LuceneDirectoryIndexOptions> indexOptions) -> void
Examine.Lucene.Directories.FileSystemDirectoryFactory.IndexOptions.get -> Microsoft.Extensions.Options.IOptionsMonitor<Examine.Lucene.LuceneDirectoryIndexOptions>
Examine.Lucene.Directories.SyncedFileSystemDirectoryFactory.SyncedFileSystemDirectoryFactory(System.IO.DirectoryInfo localDir, System.IO.DirectoryInfo mainDir, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool tryFixMainIndexIfCorrupt) -> void
Examine.Lucene.Directories.SyncedFileSystemDirectoryFactory.SyncedFileSystemDirectoryFactory(System.IO.DirectoryInfo localDir, System.IO.DirectoryInfo mainDir, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptionsMonitor<Examine.Lucene.LuceneDirectoryIndexOptions> indexOptions) -> void
Examine.Lucene.Directories.SyncedFileSystemDirectoryFactory.SyncedFileSystemDirectoryFactory(System.IO.DirectoryInfo localDir, System.IO.DirectoryInfo mainDir, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptionsMonitor<Examine.Lucene.LuceneDirectoryIndexOptions> indexOptions, bool tryFixMainIndexIfCorrupt) -> void
Examine.Lucene.Directories.TempEnvFileSystemDirectoryFactory.TempEnvFileSystemDirectoryFactory(Examine.Lucene.Directories.IApplicationIdentifier applicationIdentifier, Examine.Lucene.Directories.ILockFactory lockFactory, Microsoft.Extensions.Options.IOptionsMonitor<Examine.Lucene.LuceneDirectoryIndexOptions> indexOptions) -> void
Expand Down

0 comments on commit f7f8f4c

Please sign in to comment.