Slice pending import encoding and reuse completed immutable plans
This commit is contained in:
@@ -118,6 +118,11 @@ export async function sealRecoveryImageAsync(formatVersion:ImageVersion,rootRevi
|
||||
function* encode(plan:Prepared,depth=0,key=''):Generator<Promise<void>,Encoded,void>{
|
||||
if(plan===null||typeof plan!=='object')return normalize(plan,depth,key);
|
||||
if('height' in plan)return plan;
|
||||
// Preparation must capture every unsafe occurrence before yielding. Once an
|
||||
// earlier occurrence has assembled a proven immutable source, later plans
|
||||
// can reuse that fact without rebuilding the same JSON containers.
|
||||
const cached=immutable.get(plan.source);
|
||||
if(cached){if(depth+cached.height>64)throw fault('invalid_recovery_payload');return cached;}
|
||||
let height=0,bytes=2,reusable=true,properties=0;
|
||||
const array=plan.keys===undefined,result:Json[]|Record<string,Json>=array?[]:{};
|
||||
for(let index=0;index<plan.children.length;index++){
|
||||
|
||||
Reference in New Issue
Block a user