Files
ExperionCrawler/fastTable/step4.md
2026-04-30 08:16:21 +09:00

3.7 KiB

STEP 4 — 인터페이스: DTO + IExperionFastService 추가

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

  1. src/Core/Application/Interfaces/IExperionServices.cs 파일을 열어 전체 내용을 읽는다.
  2. 아래 항목을 확인하고 기록한다:
    • STEP 1이 완료되어 FastSession, FastRecord 클래스가 존재하는가?
    • IExperionFastService 인터페이스가 이미 존재하는가? → 있으면 이 STEP 건너뜀
    • FastSessionInfo record가 이미 존재하는가?
    • FastSessionStartRequest record가 이미 존재하는가?
    • FastSessionCreateRequest record가 이미 존재하는가?
    • FastQueryResult record가 이미 존재하는가?

작업 내용

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

파일 하단에 아래 내용을 추가한다.

DTO Records

// ── fastTable DTOs ────────────────────────────────────────────────────────────

public record FastSessionInfo(
    int      Id,
    string   Name,
    DateTime StartedAt,
    DateTime? EndedAt,
    string   Status,
    int      SamplingMs,
    int      DurationSec,
    string[] TagList,
    int      RowCount,
    int?     RetentionDays,
    bool     Pinned
);

public record FastSessionStartRequest(
    string   Name,
    int      SamplingMs,
    int      DurationSec,
    string[] TagList,
    int?     RetentionDays = null
);

public record FastSessionCreateRequest(
    string   Name,
    int      SamplingMs,
    int      DurationSec,
    string[] TagList,
    int?     RetentionDays = null
);

public record FastQueryResult(
    int                    SessionId,
    DateTime               From,
    DateTime               To,
    string[]               TagNames,
    IEnumerable<FastRecord> Items,
    int                    TotalCount
);

public record PinRequest(bool Pinned);

IExperionFastService 인터페이스

public interface IExperionFastService
{
    Task<FastSessionInfo>           StartSessionAsync(FastSessionStartRequest request);
    Task                            StopSessionAsync(int sessionId);
    Task                            DeleteSessionAsync(int sessionId);
    Task                            PinSessionAsync(int sessionId, bool pinned);
    Task<FastSessionInfo?>          GetSessionAsync(int sessionId);
    Task<IEnumerable<FastSessionInfo>> GetSessionsAsync();
    Task<FastQueryResult>           GetRecordsAsync(int sessionId, DateTime? from, DateTime? to, string format = "long");
    Task                            ExportCsvAsync(int sessionId, Stream stream, DateTime? from = null, DateTime? to = null);
}

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

  1. IExperionServices.cs 파일을 다시 열어 추가된 내용을 읽는다.
  2. 아래 항목을 하나씩 확인한다:
    • FastSessionInfo record 존재 (11개 필드)
    • FastSessionStartRequest record 존재
    • FastSessionCreateRequest record 존재 (StartRequest와 별도로)
    • FastQueryResult record 존재
    • PinRequest record 존재
    • IExperionFastService 인터페이스 존재 (메서드 8개)
    • ExportCsvAsyncStream 파라미터가 올바른가?
  3. dotnet build src/Web 실행 → 에러 0개, 경고는 기존 9개 (TextToSqlController, ExperionOpcClient, ExperionRealtimeService) 확인
  4. 문제가 있으면 수정 후 다시 빌드 확인

완료 조건

  • dotnet build src/Web 결과: 에러 0, 경고 9개 (기존)
  • DTO 5종 (FastSessionInfo, FastSessionStartRequest, FastSessionCreateRequest, FastQueryResult, PinRequest), 인터페이스 1개 (IExperionFastService) 모두 존재