存储后端协议
| 14 | |
| 15 | |
| 16 | class StorageBackend(Protocol): |
| 17 | """存储后端协议""" |
| 18 | |
| 19 | async def initialize(self) -> None: |
| 20 | """初始化存储后端""" |
| 21 | ... |
| 22 | |
| 23 | async def close(self) -> None: |
| 24 | """关闭存储后端""" |
| 25 | ... |
| 26 | |
| 27 | # 凭证管理 |
| 28 | async def store_credential(self, filename: str, credential_data: Dict[str, Any], mode: str = "geminicli") -> bool: |
| 29 | """存储凭证数据""" |
| 30 | ... |
| 31 | |
| 32 | async def get_credential(self, filename: str, mode: str = "geminicli") -> Optional[Dict[str, Any]]: |
| 33 | """获取凭证数据""" |
| 34 | ... |
| 35 | |
| 36 | async def list_credentials(self, mode: str = "geminicli") -> List[str]: |
| 37 | """列出所有凭证文件名""" |
| 38 | ... |
| 39 | |
| 40 | async def delete_credential(self, filename: str, mode: str = "geminicli") -> bool: |
| 41 | """删除凭证""" |
| 42 | ... |
| 43 | |
| 44 | # 状态管理 |
| 45 | async def update_credential_state(self, filename: str, state_updates: Dict[str, Any], mode: str = "geminicli") -> bool: |
| 46 | """更新凭证状态""" |
| 47 | ... |
| 48 | |
| 49 | async def get_credential_state(self, filename: str, mode: str = "geminicli") -> Dict[str, Any]: |
| 50 | """获取凭证状态""" |
| 51 | ... |
| 52 | |
| 53 | async def get_all_credential_states(self, mode: str = "geminicli") -> Dict[str, Dict[str, Any]]: |
| 54 | """获取所有凭证状态""" |
| 55 | ... |
| 56 | |
| 57 | # 配置管理 |
| 58 | async def set_config(self, key: str, value: Any) -> bool: |
| 59 | """设置配置项""" |
| 60 | ... |
| 61 | |
| 62 | async def get_config(self, key: str, default: Any = None) -> Any: |
| 63 | """获取配置项""" |
| 64 | ... |
| 65 | |
| 66 | async def get_all_config(self) -> Dict[str, Any]: |
| 67 | """获取所有配置""" |
| 68 | ... |
| 69 | |
| 70 | async def delete_config(self, key: str) -> bool: |
| 71 | """删除配置项""" |
| 72 | ... |
| 73 |
nothing calls this directly
no outgoing calls
no test coverage detected