Interface ICdcRepositoryLsnMapping
Provides LSN-to-time mapping and advanced LSN navigation for SQL Server CDC.
public interface ICdcRepositoryLsnMapping
Remarks
This sub-interface separates LSN mapping concerns from the core CDC data retrieval in ICdcRepository. Consumers that only need to fetch changes can depend on the smaller ICdcRepository interface.
Methods
GetLsnToTimeAsync(byte[], CancellationToken)
Maps an LSN to a commit time in the database.
Task<DateTime?> GetLsnToTimeAsync(byte[] lsn, CancellationToken cancellationToken)
Parameters
lsnbyte[]The LSN to map to a time.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<DateTime?>
A task that represents the asynchronous operation, containing the mapped commit time as a nullable DateTime.
GetNextLsnAsync(string, byte[], CancellationToken)
Retrieves the next Log Sequence Number (LSN) after the specified last processed LSN for a specific capture instance.
Task<byte[]?> GetNextLsnAsync(string captureInstance, byte[] lastProcessedLsn, CancellationToken cancellationToken)
Parameters
captureInstancestringThe name of the capture instance to query for the next LSN.
lastProcessedLsnbyte[]The LSN from which to find the next LSN.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<byte[]>
A task that represents the asynchronous operation, containing the next LSN as a nullable byte array, or null if no next LSN is available.
GetNextValidLsnAsync(byte[], CancellationToken)
Retrieves the next valid LSN after the specified last processed LSN.
Task<byte[]?> GetNextValidLsnAsync(byte[] lastProcessedLsn, CancellationToken cancellationToken)
Parameters
lastProcessedLsnbyte[]The LSN from which to find the next valid LSN.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<byte[]>
A task that represents the asynchronous operation, containing the next valid LSN as a nullable byte array.
GetTimeToLsnAsync(DateTime, string, CancellationToken)
Maps a time to an LSN using the specified relational operator.
Task<byte[]?> GetTimeToLsnAsync(DateTime lsnDate, string relationalOperator, CancellationToken cancellationToken)
Parameters
lsnDateDateTimeThe date to map to an LSN.
relationalOperatorstringThe relational operator for mapping (e.g., "smallest greater than", "largest less than or equal").
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.