外观
scopes API
完整接口目录 · 资源 Scope用法 · 工具包下载
模块说明
text
Authority-owned resource scopes, with one execution of author callbacks.ScopeCondition
python
@dataclass(frozen=True)
class ScopeCondition字段(包含继承字段):
ScopeCondition.kind
python
kind: str数据类字段;声明于 scopes.ScopeCondition。
ScopeCondition.arguments_json
python
arguments_json: str数据类字段;声明于 scopes.ScopeCondition。
ScopeCondition.near
python
@classmethod
def near(cls, target, distance)ScopeSpec
python
@dataclass(frozen=True)
class ScopeSpec字段(包含继承字段):
ScopeSpec.resources
python
resources: list[str]数据类字段;声明于 scopes.ScopeSpec。
ScopeSpec.conditions
python
conditions: list[ScopeCondition] = field(default_factory=list)数据类字段;声明于 scopes.ScopeSpec。
ScopeSpec.lease_ms
python
lease_ms: i64 = 30000数据类字段;声明于 scopes.ScopeSpec。
Resources
python
class ResourcesSDK 说明:
text
Purpose declarations; dependency closure is computed by the Host.Resources.inventory_session
python
@staticmethod
def inventory_session()Resources.position_control
python
@staticmethod
def position_control()Resources.container_session
python
@staticmethod
def container_session(dimension: int, x: int, y: int, z: int)ScopeHandle
python
@dataclass(frozen=True)
class ScopeHandle字段(包含继承字段):
ScopeHandle.id
python
id: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.request_id
python
request_id: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.installation
python
installation: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.generation
python
generation: i64数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.session_id
python
session_id: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.epoch
python
epoch: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.action_session
python
action_session: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.state
python
state: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.resources
python
resources: list[str]数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.expires_at
python
expires_at: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.max_expires_at
python
max_expires_at: str数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.operation_ids
python
operation_ids: list[str]数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.pending_operation_ids
python
pending_operation_ids: list[str]数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.frontier
python
frontier: i64数据类字段;声明于 scopes.ScopeHandle。
ScopeHandle.pending
python
pending: i64数据类字段;声明于 scopes.ScopeHandle。
ScopeError
python
class ScopeError(BusError)SDK 说明:
text
Retained IDs and independent business/cleanup failures for reconciliation.ScopeError.__init__
python
def __init__(
self,
code,
*,
request_id = None,
handle = None,
business_error = None,
cleanup_error = None,
)ScopeError.request_id
python
self.request_id公开实例属性,在 __init__ 中设置。
ScopeError.handle
python
self.handle公开实例属性,在 __init__ 中设置。
ScopeError.business_error
python
self.business_error公开实例属性,在 __init__ 中设置。
ScopeError.cleanup_error
python
self.cleanup_error公开实例属性,在 __init__ 中设置。
ScopeResult
python
@dataclass(frozen=True)
class ScopeResult字段(包含继承字段):
ScopeResult.value
python
value: object数据类字段;声明于 scopes.ScopeResult。
ScopeResult.handle
python
handle: ScopeHandle | None数据类字段;声明于 scopes.ScopeResult。
ScopeResult.business_error
python
business_error: BaseException | None = None数据类字段;声明于 scopes.ScopeResult。
ScopeResult.cleanup_error
python
cleanup_error: BaseException | None = None数据类字段;声明于 scopes.ScopeResult。
Scopes
python
class ScopesScopes.__init__
python
def __init__(self, bus, *, session_id=None)Scopes.remote
python
@classmethod
async def remote(cls, bus)SDK 说明:
text
Open one trusted EP session; call aclose when its transport ends.Scopes.aclose
python
async def aclose(self)Scopes.__aenter__
python
async def __aenter__(self)Scopes.__aexit__
python
async def __aexit__(self, kind, business, traceback)Scopes.open
python
def open(self, spec, *, request_id=None, timeout=30)SDK 说明:
text
Use ``async with ctx.scopes.open(spec) as scope`` for automatic cleanup.Scopes.acquire
python
async def acquire(self, spec, *, request_id=None, timeout=30)Scopes.seal
python
def seal(self)Scopes.join
python
async def join(self)Scopes.activate
python
def activate(self)Scopes.lookup
python
async def lookup(self, request_id)Scopes.read
python
async def read(self, scope_id, *, timeout=5)Scopes.run
python
async def run(self, spec, callback, *, request_id=None, timeout=30)Scopes.bus
python
self.bus公开实例属性,在 __init__ 中设置。
Scopes.session_id
python
self.session_id公开实例属性,在 __init__、remote 中设置。
ResourceScope
python
class ResourceScopeResourceScope.__init__
python
def __init__(self, scopes, handle, *, renew=True)ResourceScope.id
python
@property
def id(self)ResourceScope.context
python
@contextmanager
def context(self)SDK 说明:
text
Propagate scope and existing cause to all normal SDK child calls.ResourceScope.__aenter__
python
async def __aenter__(self)ResourceScope.__aexit__
python
async def __aexit__(self, kind, business, traceback)ResourceScope.evidence
python
async def evidence(self, *resources)ResourceScope.close
python
async def close(self, *, timeout=5)ResourceScope.scopes
python
self.scopes公开实例属性,在 __init__ 中设置。
ResourceScope.handle
python
self.handle公开实例属性,在 __init__、_renew、_close 中设置。