Files
ExperionCrawler/fastTable/step5.md

4.0 KiB

STEP 5 — 인터페이스: IExperionOpcClient + IExperionDbService 확장

사전 확인 (작업 전 반드시 수행)

  1. src/Core/Application/Interfaces/IExperionOpcClient.cs 파일을 열어 전체 내용을 읽는다.
  2. src/Core/Application/Interfaces/IExperionDbService.cs 파일을 열어 전체 내용을 읽는다.
  3. 아래 항목을 확인하고 기록한다:
    • STEP 4가 완료되어 DTO들이 존재하는가?
    • IExperionOpcClientIsConnectedAsync 메서드가 이미 있는가?
    • IExperionOpcClientCreateSessionAsync 메서드가 이미 있는가?
    • IExperionDbServiceCreateFastSessionAsync 메서드가 이미 있는가?
    • IExperionDbServiceBatchInsertFastRecordsAsync 메서드가 이미 있는가?
    • IExperionDbServiceGetExpiredFastSessionsAsync 메서드가 이미 있는가?

작업 1 — IExperionOpcClient 확장

파일: src/Core/Application/Interfaces/IExperionOpcClient.cs

인터페이스에 아래 두 메서드를 추가한다:

// fastTable용 메서드
Task<bool>     IsConnectedAsync(ApplicationConfiguration cfg);
Task<ISession> CreateSessionAsync(ApplicationConfiguration cfg);

작업 2 — IExperionDbService 확장

파일: src/Core/Application/Interfaces/IExperionDbService.cs

인터페이스에 아래 메서드들을 추가한다:

// ── FastSession ───────────────────────────────────────────────────────────────
Task<FastSession>              CreateFastSessionAsync(FastSessionCreateRequest request);
Task                           UpdateFastSessionStatusAsync(int sessionId, string status);
Task                           UpdateFastSessionRowCountAsync(int sessionId, int rowCount);
Task                           UpdateFastSessionPinnedAsync(int sessionId, bool pinned);
Task<FastSession?>             GetFastSessionAsync(int sessionId);
Task<IEnumerable<FastSession>> GetFastSessionsAsync();
Task                           DeleteFastSessionAsync(int sessionId);
Task<IEnumerable<FastSession>> GetExpiredFastSessionsAsync();

// ── FastRecord ────────────────────────────────────────────────────────────────
Task<FastQueryResult> GetFastRecordsAsync(int sessionId, DateTime? from, DateTime? to);
Task                  BatchInsertFastRecordsAsync(IEnumerable<FastRecord> records);
Task                  ExportFastRecordsToCsvAsync(int sessionId, Stream stream, DateTime? from, DateTime? to);

// ── 공통 (이미 없는 경우만) ──────────────────────────────────────────────────
Task<string?> GetNodeIdByTagNameAsync(string tagName);

사후 확인 (작업 후 반드시 수행)

  1. 두 파일을 다시 열어 변경 내용을 읽는다.
  2. 아래 항목을 하나씩 확인한다:
    • IExperionOpcClientIsConnectedAsync(ApplicationConfiguration cfg) 존재
    • IExperionOpcClientCreateSessionAsync(ApplicationConfiguration cfg) 존재
    • IExperionDbService에 FastSession 관련 메서드 8개 모두 존재
    • IExperionDbService에 FastRecord 관련 메서드 3개 모두 존재
    • IExperionDbServiceGetNodeIdByTagNameAsync 존재
    • 반환 타입이 올바른가? (Task<FastSession?> nullable 포함)
  3. dotnet build src/Web 실행 → 에러 14개 (구현체 미완료, STEP 6~7에서 해결)
  4. 구현체 빌드 에러는 예상된 결과 (인터페이스만 추가한 단계)

⚠️ 주의: 인터페이스만 추가하는 단계이므로 구현체 빌드 에러는 STEP 6~7에서 해결한다.


완료 조건

  • dotnet build src/Web 결과: 에러 14개 (구현체 미완료, STEP 6~7에서 해결)
  • 두 인터페이스에 지정된 메서드 시그니처 모두 존재