refactor(core/policy): 从 policy_context_t 中提取 event 为独立参数
policy_context_t 应该只包含所有 policy 相关接口都需要用到的参数,而 event 只是 policy_route_event 接口需要的参数,故应该将其从 policy_context_t 中剔除
This commit is contained in:
@@ -9,10 +9,23 @@
|
||||
typedef struct policy_context_t {
|
||||
const state_t *state;
|
||||
const rules_t *rules;
|
||||
const event_t *event;
|
||||
} policy_context_t;
|
||||
|
||||
bool policy_route_event(const policy_context_t *ctx, command_buffer_t *out);
|
||||
/**
|
||||
* @brief 事件路由:将运行时事件翻译为语义命令
|
||||
*
|
||||
* @param ctx 策略上下文
|
||||
* @param event 需要翻译的事件
|
||||
* @param out 命令输出缓冲区,路由产生的命令追加到此处
|
||||
*
|
||||
* @return true 产生了至少一条需要执行的命令
|
||||
* @return false 产生了至少一条需要执行的命令
|
||||
*/
|
||||
bool policy_route_event(
|
||||
const policy_context_t *ctx,
|
||||
const event_t *event,
|
||||
command_buffer_t *out
|
||||
);
|
||||
bool policy_apply_command(
|
||||
const policy_context_t *ctx,
|
||||
const command_buffer_t *command_buffer,
|
||||
|
||||
Reference in New Issue
Block a user