Actions
이슈 #311
진행중
CP
JL
17-2. 노드 상세 정보 API
이슈 #311:
17-2. 노드 상세 정보 API
설명
GET /api/nodes/:id
CP Chris Park이(가) 7달 전에 변경
- 프로젝트을(를) 14에서 Alphea App(으)로 변경되었습니다.
- 목표버전을(를) 6월 중간 버전(으)로 지정되었습니다.
JL James Lee이(가) 7달 전에 변경
17-2. 노드 상세 정보 API 구현 완료¶
NodeService.GetNode RPC 를 Rust + tonic 으로 구현했습니다.
-
Repository:
alphea-ai-edge -
Commit: commit:server|7828037 —
feat: add NodeService with read-only ListNodes and GetNode RPCs - 관련 이슈: #254 (DB 쿼리 추가), #310 (동일 커밋에 포함)
구현 내용¶
Proto 정의
rpc GetNode(GetNodeRequest) returns (NodeInfo);
message GetNodeRequest { string node_id = 1; }
응답은 공용 NodeInfo 메시지 (30개 필드) 그대로.
DB 쿼리 (src/store/nodes.rs::get_by_id)
SELECT {모든 컬럼} FROM nodes WHERE node_id = $1
30개 컬럼 전체를 #[derive(FromRow)] 이 붙은 NodeRow 로 읽은 뒤 row_to_proto() 로 proto NodeInfo 로 변환합니다.
핸들러 (src/handler/node.rs::get_node)
-
node_id빈 문자열 →InvalidArgument - 행 없음 →
NotFound("node not found") - 행 있음 → 30개 필드 + JSONB
device_meta역직렬화된NodeInfo반환
E2E 검증 결과 (grpcurl)¶
존재하는 노드
$ grpcurl -plaintext -d '{"nodeId":"rn_7a72e61a_demo-device-42"}' localhost:3000 alphea.v1.NodeService/GetNode
{
"id": "1",
"nodeId": "rn_7a72e61a_demo-device-42",
"name": "Mobile 7a72e61a",
"nodeType": "NODE_TYPE_MOBILE",
"ownerWalletAddress": "0x7a72e61aaadd48917e5845d41f0f7575831c56af",
"authMode": "AUTH_MODE_INTERNAL",
"status": "NODE_STATUS_ACTIVE",
"tier": "NODE_TIER_LOW",
"role": "NODE_ROLE_WORKER",
"maxConcurrentJobs": 5, "throughputHint": 100, "score": 50,
"successRate1m": 1,
"deviceId": "demo-device-42",
"deviceMeta": {
"platform": "ios", "model": "iPhone 15 Pro",
"screenResolution": "1290x2796",
"appVersion": "0.1.0",
"timezone": "Asia/Seoul"
},
"devicePlatform": "ios",
"createdAt": "1776242428",
"updatedAt": "1776242428"
}
존재하지 않는 노드
$ grpcurl -plaintext -d '{"nodeId":"rn_none"}' localhost:3000 alphea.v1.NodeService/GetNode
ERROR:
Code: NotFound
Message: node not found
알려진 한계¶
- Public RPC 로 등록되어 있음 (레거시 allow-list 와 동일, 인증 불필요)
- 삭제된 (archived) 노드는 아직 없음 — #313 에서 도입 예정
Actions