IRelationalSourceDriver.cs 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. namespace Admin.NET.Plugin.AiDOP.DataPlatform.Core.Connectors;
  2. /// <summary>Trusted host plugin. Dialect, identifier quoting, type mapping and ordered
  3. /// parameterized reads belong to the driver. Resolve the secret only within the supplied binding.</summary>
  4. public interface IRelationalSourceDriver
  5. {
  6. string ConnectorId { get; }
  7. string ConnectorVersion { get; }
  8. Task<IRelationalReadSession> OpenReadOnlyAsync(
  9. ConnectorExecution execution, string secretRef, CancellationToken cancellationToken);
  10. }
  11. /// <summary>One source connection. Probe the effective permissions and ordering capabilities
  12. /// of this connection. An unverifiable permission or capability must be reported as false.</summary>
  13. public interface IRelationalReadSession : IAsyncDisposable
  14. {
  15. Task<RelationalReadCapabilities> ProbeAsync(CancellationToken cancellationToken);
  16. /// <summary>Read at most BatchSize rows after the supplied committed position, using the
  17. /// authorized dataset mapping. A nonempty page transfers ownership of its payload to the caller
  18. /// (valid after disposal of the session). Return null at end of input. Reading never commits a position.</summary>
  19. Task<ConnectorBatchCandidate?> ReadPageAsync(ConnectorReadRequest request, CancellationToken cancellationToken);
  20. }
  21. public sealed record RelationalReadCapabilities(bool ReadOnly, bool Full, bool Incremental)
  22. {
  23. public string? Reason { get; init; }
  24. }
  25. public sealed record RelationalReadBatch(ConnectorFrozenBatch Batch, bool HasMore);