Created
August 22, 2020 13:22
-
-
Save martinrayenglish/a30f58b4423b48a4237e90c024f122c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Sitecore.Framework.Conditions; | |
using Sitecore.Xdb.Collection.Indexing; | |
using Sitecore.Xdb.Collection.Model; | |
namespace Test.SCExtensions.Xdb.Collection.Search.Solr | |
{ | |
internal sealed class IndexWriterFilterDecorator : IIndexWriter | |
{ | |
private readonly IIndexWriter _writer; | |
public IndexWriterFilterDecorator(IIndexWriter writer) | |
{ | |
this._writer = Condition.Requires<IIndexWriter>(writer, nameof (writer)).IsNotNull<IIndexWriter>().Value; | |
} | |
public async Task<Task> Write(ChangedDataRecords changes, CancellationToken cancellationToken) | |
{ | |
changes = Condition.Requires<ChangedDataRecords>(changes, nameof (changes)).IsNotNull<ChangedDataRecords>().Value; | |
ChangedDataRecords filteredChanges = new ChangedDataRecords(changes.get_ContactRecords(), (IReadOnlyCollection<InteractionDataRecord>) new List<InteractionDataRecord>().AsReadOnly(), changes.get_DeletedContactIds(), changes.get_DeletedInteractionIds()); | |
Task task = await this._writer.Write(filteredChanges, cancellationToken).ConfigureAwait(false); | |
return task; | |
} | |
public async Task SignalChangesHaveBeenWritten(byte[] token, CancellationToken cancellationToken) | |
{ | |
await this._writer.SignalChangesHaveBeenWritten(token, cancellationToken).ConfigureAwait(false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment