docs(iot): 存量英文注释中文化(仅注释,代码零字节改动)
- 5 个文件:123 行英文注释 → 99 行中文注释(中文更紧凑,内容无删减)。 - 机械校验(git diff -U0 去掉 // 行与空行)输出为空;gofmt -l 干净(改动前亦干净)。 - 验收:go build/vet/test ./internal/iot/... 全绿。
This commit is contained in:
1 parent
127c32b440
commit
2593765add
5 files changed
+99
-123
No files matched your search
+10
-13
@@ -2,23 +2,20 @@ package iot
|
||||
|
||||
import "context"
|
||||
|
||||
// Provider is a pluggable source of IoT devices. Implementations own the device
|
||||
// state and enforce the control_rules (capability constraints) for each device
|
||||
// type, so a type's set of supported actions is its capability.
|
||||
// Provider 是可插拔的 IoT 设备来源。实现方持有设备状态,并为每种设备类型施加
|
||||
// control_rules(capability 约束)——因此某类型支持的动作集合即其能力边界。
|
||||
//
|
||||
// Implementations must be safe for concurrent use, because the Manager may serve
|
||||
// List/Control/Status from multiple goroutines.
|
||||
// 实现必须是并发安全的,因为 Manager 可能从多个 goroutine 并发调用
|
||||
// List/Control/Status。
|
||||
type Provider interface {
|
||||
// Name returns the stable provider identifier, used for logging and to
|
||||
// disambiguate providers registered on one Manager.
|
||||
// Name 返回稳定的 Provider 标识,用于日志,以及区分注册在同一 Manager 上的
|
||||
// 多个 Provider。
|
||||
Name() string
|
||||
// List returns every device currently known to the provider.
|
||||
// List 返回该 Provider 当前已知的全部设备。
|
||||
List(ctx context.Context) ([]Device, error)
|
||||
// Control applies action with params to the named device and returns the
|
||||
// post-transition device. It returns ErrDeviceNotFound for an unknown device
|
||||
// and ErrUnsupported for an action the device's type does not support.
|
||||
// Control 对指定设备施加 action(携带 params),并返回跃迁后的设备。
|
||||
// 设备未知时返回 ErrDeviceNotFound;设备类型不支持该动作时返回 ErrUnsupported。
|
||||
Control(ctx context.Context, deviceID, action string, params map[string]any) (*Device, error)
|
||||
// Status returns the current state of the named device. It returns
|
||||
// ErrDeviceNotFound when the device is unknown.
|
||||
// Status 返回指定设备的当前状态;设备未知时返回 ErrDeviceNotFound。
|
||||
Status(ctx context.Context, deviceID string) (*Device, error)
|
||||
}
|
||||
Reference in new issue
Block a user