docs(canvas): explain import parsers, identities and integrity gates
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
/**
|
||||
* 导入runner内的自适应批大小反馈,不持久化进job,也不改变记录/ID或依赖规则。
|
||||
* 从一条开始试探,超时缩小、满批且便宜才增长;每次原子发布仍可能有不可抢占固定成本。
|
||||
*/
|
||||
/** Runner-owned feedback, not persisted job state. Probe bounded batches to
|
||||
* distinguish fixed publication cost from the marginal cost of another unit. */
|
||||
/** budget/max由runner给出,用实际已提交units和耗时更新下一批软上限。 */
|
||||
export function createImportBatches(budget:number,max:number){
|
||||
// 初始未观测时保守为1;observed只表示收到反馈,不是源校验或导入已完成。
|
||||
let limit=1,observed=false;
|
||||
return Object.freeze({
|
||||
/** 下次组选择的单位软预算,依赖SCC仍可能需要一次超过它。 */
|
||||
get limit(){return limit;},
|
||||
/** 是否已有至少一次发布成本样本,用于runner的调度决策。 */
|
||||
get observed(){return observed;},
|
||||
/** 超时按比例减小并至少降一档;不足当前limit的尾批不能证明更大批也便宜。 */
|
||||
record(units:number,elapsed:number){
|
||||
observed=true;
|
||||
if(elapsed>budget){limit=Math.max(1,Math.min(limit-1,Math.floor(units*budget/elapsed)));return;}
|
||||
|
||||
Reference in New Issue
Block a user