Skip to content

INTERNAL: Add an error module with arcus-memcached replies - #9

Merged
jhpark816 merged 1 commit into
developfrom
error
Oct 27, 2026
Merged

jhpark816 merged 1 commit into
developfrom
error

Conversation

@ing-eoking

@ing-eoking ing-eoking commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

  • #8의 후속 PR입니다.

⌨️ What I did

vop 명령의 실패 응답을 src/error.rs의 Error enum 하나로 모읍니다.
응답 문구는 arcus-memcached가 같은 상황에 쓰는 문구를 그대로 따릅니다.

  • 아직 쓰지 않는 에러가 있어 #[expect(dead_code)]로 표시했습니다.

응답 목록

variant 응답 쓰는 상황
BadCommandLine CLIENT_ERROR bad command line format 명령줄 오류
BadDataChunk CLIENT_ERROR bad data chunk 본문 길이·\r\n이 선언과 다름
TooLargeValue CLIENT_ERROR too large value 본문·필터가 크기 제한 초과
BadValue CLIENT_ERROR bad value 벡터 차원 불일치, 메타데이터·필터 내용 오류
NotFound NOT_FOUND 인덱스 없음
NotFoundElement NOT_FOUND_ELEMENT 인덱스에 해당 vkey 없음
TypeMismatch TYPE_MISMATCH 키가 인덱스가 아님
OutOfMemory SERVER_ERROR out of memory 할당 실패
Internal SERVER_ERROR internal 엔진·인덱스 내부 오류

Summary by CodeRabbit

  • 버그 수정
    • 잘못된 명령 형식과 지나치게 큰 값에 대해 구분된 프로토콜 오류 응답을 반환합니다.
    • 명령 처리 결과를 여러 조각으로 나누지 않고 한 번에 응답하도록 변경했습니다. 지원하지 않는 명령은 일관된 오류 응답을 받으며, 처리 중 발생한 오류도 해당 오류에 맞는 응답으로 전달됩니다.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 9ffa252 and 065cd97.

Files selected for processing: 5
  • src/ascii.rs
  • src/error.rs
  • src/lib.rs
  • src/protocol.rs
  • src/protocol/tokens.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

공통 Error 타입과 오류별 응답 바이트를 추가했습니다. 프로토콜 파싱 오류와 ASCII 응답 전송 경로가 새 타입을 사용합니다. 파싱 규칙과 기본값은 유지됩니다.

Changes

오류 응답 통합

Layer / File(s) Summary
오류 타입과 응답 계약
src/error.rs, src/lib.rs
아홉 가지 오류 변형과 각 변형의 CRLF 종료 응답을 정의하고 error 모듈을 등록합니다.
프로토콜 파싱 오류 통합
src/protocol.rs, src/protocol/tokens.rs
파서와 토큰 처리에서 공통 Error 변형을 사용합니다. 관련 테스트 기대값도 새 변형에 맞춥니다.
ASCII 응답 전송
src/ascii.rs
성공 응답과 파싱 오류 응답을 각각 전체 바이트 슬라이스로 한 번의 콜백 호출에 전달합니다.

Priority: Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Refactor

Suggested reviewers: zhy2on

Merge Risk: Minimal · previous review 065cd

No actionable merge-blocking issue is established by the supplied evidence. The change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 제목은 Error 모듈 추가와 Arcus-memcached 응답 중앙화를 정확하게 설명합니다. 주요 변경 사항과 일치하며 충분히 구체적입니다.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ing-eoking
ing-eoking marked this pull request as draft October 26, 2026 02:43
@ing-eoking
ing-eoking force-pushed the error branch 2 times, most recently from 7035b99 to 042dbc9 Compare October 26, 2026 13:50
@ing-eoking
ing-eoking changed the base branch from protocol to develop October 26, 2026 14:07
@ing-eoking
ing-eoking marked this pull request as ready for review October 26, 2026 15:10
Comment thread src/error.rs
impl Error {
/// The reply line, worded as arcus-memcached words the same failure.
pub const fn reply(self) -> &'static [u8] {
match self {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXIST 추가해주세요

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추가되었습니다.

Overflowed 응답도 추가되었습니다.

This branch was successfully deployed

1 active deployment
ee — 5838d2cf Deployed Oct 27, 2026 by ing-eoking via Build arcus-memcached #37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants