Skip to content

INTERNAL: Parse vop command lines - #8

Open
ing-eoking wants to merge 1 commit into
developfrom
protocol
Open

ing-eoking wants to merge 1 commit into
developfrom
protocol

Conversation

@ing-eoking

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

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

vop 명령줄을 파싱해 형식을 검사합니다.

지원하는 명령줄
vop create  <index> <dim> <expiretime> [<maxcount>] [metric m] [quant q] [M n] [efc c] [efs s]
vop upsert  <index> <vkey> <vector_bytes> [meta <metabytes>] [bin|str]
vop setmeta <index> <vkey> <metabytes>
vop search  <index> vkey <vkey> <num> [filter <f>] [withmeta]
vop search  <index> vector <num> <vector_bytes> [filter <f>] [withmeta] [bin|str]
vop getmeta <index> <vkey>
vop delete  <index> <vkey>
vop drop    <index>
검사 항목

하이퍼 파라미터의 경우 너무 큰 수치를 주면 성능저하가 발생하여 우선 MAX치를 지정했습니다.
(문서는 추후에 추가할 예정입니다.)

대상 검사
공통 인자 개수, 알 수 없는 하위 명령·옵션, 같은 옵션 중복
create dim 1 ~ 65535 , maxcount 1 이상 , M 2-1024, efc·efs 1~65536
create metric·quant b1은 hamming·tanimoto 전용, hamming·tanimoto는 b1 필수
search 결과 개수 1~i32::MAX, filter 4096바이트 이하
각 모듈 별 역할
  • src/protocol/tokens.rs: memcached가 넘긴 토큰 배열을 읽는 Tokens. unsafe는 생성자에만 있습니다.
  • src/protocol.rs: vop 명령줄의 문법을 다룸. 토큰을 읽어 하위 명령과 인자를 확인
  • tokens.rs: 토큰 배열(C 포인터)을 Rust에서 안전하게 읽게 해줍니다.

Summary by CodeRabbit

  • 새 기능
    • Arcus ASCII 프로토콜 확장을 초기화하고 서버에 등록할 수 있습니다.
    • 인증 없이 vop 명령을 처리하며, 생성·업서트·메타데이터·검색 등 관련 명령의 형식과 매개변수를 확인합니다.
  • 오류 처리
    • 명령 형식이 잘못되었거나 옵션·값이 유효하지 않으면 오류 사유를 포함한 응답을 받습니다.
    • 형식이 올바른 요청은 지원되지 않는 명령임을 알리는 응답을 받습니다. 응답 처리기가 없거나 연결 상태가 비정상인 경우에는 연결 처리가 거부됩니다.

@coderabbitai

coderabbitai Bot commented Oct 24, 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

Walkthrough

Arcus memcached 확장 초기화 진입점과 arcus_vector ASCII 프로토콜 디스크립터를 추가했습니다. vop 요청을 파싱하고, 파싱 성공 시 NOT_SUPPORTED, 실패 시 오류 사유가 포함된 CLIENT_ERROR를 응답합니다.

Changes

Arcus ASCII 확장

Layer / File(s) Summary
FFI 토큰 입력
src/protocol/tokens.rs
token_t 배열을 빌려 쓰는 Tokens 래퍼와 테스트용 토크나이저를 추가했습니다.
요청 파싱
src/protocol.rs
요청 타입과 명령별 파서를 추가했습니다. 생성 매개변수, 옵션, 필터 길이, 검색 결과 수 등을 검증하고, 관련 테스트를 추가했습니다.
ASCII 명령 처리
src/ascii.rs
vop 명령만 수락하는 ASCII 디스크립터와 콜백을 추가했습니다. 파싱 성공과 실패에 따라 각각 NOT_SUPPORTED와 CLIENT_ERROR를 전송합니다. 패닉 상태와 응답 콜백 실패도 처리합니다.
확장 초기화 및 등록
src/lib.rs
C ABI 초기화 진입점에서 필요한 API와 등록 함수를 확인하고 ASCII 프로토콜 디스크립터를 등록합니다. 초기화 중 패닉과 등록 실패에는 fatal 오류 코드를 반환합니다.

Priority: Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant memcached
  participant accept
  participant execute
  participant parse
  participant response_handler
  memcached->>accept: vop 토큰 전달
  accept-->>memcached: 명령 수락 여부 반환
  memcached->>execute: 수락한 명령 실행
  execute->>parse: 토큰 파싱 요청
  parse-->>execute: Request 또는 Error 반환
  execute->>response_handler: NOT_SUPPORTED 또는 CLIENT_ERROR 전송
  response_handler-->>execute: 응답 호출 결과 반환
Loading

Possibly related PRs

  • jam2in/arcus-vector#1: cdylib 설정과 memcached의 라이브러리 로딩 계약을 추가합니다. 이 PR의 확장 초기화 진입점은 해당 로딩 경로에서 사용됩니다.
  • jam2in/arcus-vector#3: memcached 헤더에서 생성한 FFI 타입을 제공합니다. 이 PR은 초기화와 ASCII 명령 처리에 해당 타입을 사용합니다.

Suggested reviewers: zhy2on, jhpark816

Merge Risk: Moderate · up to 1d933

Fix the request-path allocation risk and reject duplicate create options before merging; memory pressure could otherwise terminate memcached, and duplicate options are accepted contrary to the command contract.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 4 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 제목은 vop 명령행 파싱이라는 PR의 주요 변경을 정확히 설명합니다. INTERNAL: 접두사는 다소 불필요하지만 제목의 의미를 방해하지 않습니다.
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 changed the title Protocol INTERNAL: Parse vop command lines Oct 24, 2026
coderabbitai[bot]

This comment was marked as resolved.

@ing-eoking
ing-eoking marked this pull request as ready for review October 26, 2026 01:46

This branch was successfully deployed

1 active deployment
ee — 9ffa2528 Deployed Oct 26, 2026 by ing-eoking via Build arcus-memcached #34
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.

1 participant