public string GetItemInformation(ReplicationBatchItem item) { return(item switch { AttachmentReplicationItem a => "Attachment for " + GetDocumentId(a.Key), AttachmentTombstoneReplicationItem at => "Attachment tombstone for: " + GetDocumentId(at.Key), CounterReplicationItem c => "Counter for " + c.Id, DocumentReplicationItem d => "Document " + d.Id, RevisionTombstoneReplicationItem r => "Revision for: " + r.Id, TimeSeriesDeletedRangeItem td => "Time Series deletion range for: " + GetDocumentId(td.Key), TimeSeriesReplicationItem t => "Time Series for: " + GetDocumentId(t.Key), _ => throw new ArgumentOutOfRangeException($"{nameof(item)} - {item}") });
public bool ShouldAllow(ReplicationBatchItem item) { return item switch { AttachmentReplicationItem a => AllowId(GetDocumentId(a.Key)), AttachmentTombstoneReplicationItem at => AllowId(GetDocumentId(at.Key)), CounterReplicationItem c => AllowId(c.Id), DocumentReplicationItem d => AllowId(d.Id), RevisionTombstoneReplicationItem _ => true, // revision tombstones doesn't contain any info about the doc. The id here is the change-vector of the deleted revision TimeSeriesDeletedRangeItem td => AllowId(GetDocumentId(td.Key)), TimeSeriesReplicationItem t => AllowId(GetDocumentId(t.Key)), _ => throw new ArgumentOutOfRangeException($"{nameof(item)} - {item}") }; }