This repository was archived by the owner on Apr 23, 2026. It is now read-only.
refactor(proxmox-client): trait 도입으로 match AccessType 중복 소거 (1/2) - #72
Merged
Conversation
fetch_containers / start_container / stop_container / console_cmd 4개에서
반복되던 match server.access { Ssh => ..., Api => ... } 을 ProxmoxClient trait
으로 대체.
- pub trait ProxmoxClient { fetch_containers_raw / start / stop / console }
- SshProxmoxClient / ApiProxmoxClient (둘 다 &ProxmoxServer 참조)
- client_for(server) -> Box<dyn ProxmoxClient + '_>
- 기존 free fn 4개는 시그니처 유지한 채 내부 1~2줄 wrapper 로 축소
- 캐시·정렬 로직은 wrapper 레벨에 그대로 두어 공통화 (+fetch_containers)
- 호출부(cli/main) 변경 없음
후속: fetch_host_info / resources / docker / ports / snapshots / *_cmd 들도
같은 방식으로 trait 에 흡수 예정 (PR 2/2)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
Dalteam ReviewNo findings. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`fetch_containers` / `start_container` / `stop_container` / `console_cmd` 4개 함수에서 반복되던 `match server.access { Ssh => ..., Api => ... }` 분기를 `ProxmoxClient` trait 으로 대체.
API
```rust
pub trait ProxmoxClient {
fn fetch_containers_raw(&self) -> Vec;
fn start(&self, c: &Container);
fn stop(&self, c: &Container);
fn console(&self, c: &Container) -> Option;
}
```
남은 것 (PR 2/2 예정)
`fetch_host_info / fetch_resources / fetch_docker / fetch_ports / fetch_snapshots / docker_logs_cmd / container_logs_cmd / docker_exec_cmd` — 이 rest 도 trait 에 흡수하면 모든 `match AccessType` 이 사라짐. 범위가 커 분리.
Test plan
🤖 Generated with Claude Code