ConnectionStrategy
public interface ConnectionStrategy
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:22–45定义连接 Strategy契约的接口。位于 io.agentscope.extensions.sandbox.kubernetes.client.internal.strategy 包。核心成员包括 connect、close、shouldInjectRouterHeaders。
Strategy for discovering the HTTP base URL used to reach a sandbox.
Mirrors the Python SDK's ConnectionStrategy.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String connect() throws Exception | 建立连接并完成初始化。 Discover and return the base URL. |
default public void close()default | 关闭连接并释放相关资源。 Release any resources held by this strategy (e.g. |
default public boolean shouldInjectRouterHeaders()default | 返回 `shouldInjectRouterHeaders` 结果。 Whether `X-Sandbox-*` router headers should be injected into requests. |
方法详情Method Detail
connect
public String connect() throws Exception
建立连接并完成初始化。
Discover and return the base URL.
String返回字符串结果。the base URL (e.g. `http://127.0.0.1:12345`)
Exception可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:30close
default public void close()
default
关闭连接并释放相关资源。
Release any resources held by this strategy (e.g.
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:33–35shouldInjectRouterHeaders
default public boolean shouldInjectRouterHeaders()
default
返回 shouldInjectRouterHeaders 结果。
Whether X-Sandbox-* router headers should be injected into requests.
boolean返回布尔值,表示判断结果。true for router-based strategies; false for in-cluster direct
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:42–44