@abtnode/core 1.16.11-next-3e55bc95 → 1.16.11-next-48aec895
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/blocklet/manager/disk.js +23 -7
- package/package.json +17 -17
|
@@ -659,9 +659,20 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
659
659
|
* @param {import('@abtnode/client').RequestRestoreBlockletInput} input
|
|
660
660
|
* @memberof BlockletManager
|
|
661
661
|
*/
|
|
662
|
-
|
|
663
|
-
restoreBlocklet(input, context) {
|
|
662
|
+
async restoreBlocklet(input, context) {
|
|
664
663
|
const { from, ...param } = input;
|
|
664
|
+
|
|
665
|
+
if (input.overwrite) {
|
|
666
|
+
try {
|
|
667
|
+
const blocklet = await this.getBlocklet(input.appPid);
|
|
668
|
+
if (blocklet) {
|
|
669
|
+
await this.delete({ did: input.appPid, keepData: false, keepLogsDir: false, keepConfigs: false }, context);
|
|
670
|
+
}
|
|
671
|
+
} catch (error) {
|
|
672
|
+
logger.error('Failed to delete blocklet', { error, did: input.appPid });
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
665
676
|
if (from === 'spaces') {
|
|
666
677
|
return this._restoreFromSpaces(param, context);
|
|
667
678
|
}
|
|
@@ -1461,9 +1472,11 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
1461
1472
|
|
|
1462
1473
|
try {
|
|
1463
1474
|
const status = await getProcessState(component.env.processId);
|
|
1475
|
+
const oldStatus = component.status;
|
|
1464
1476
|
if (component.status !== status) {
|
|
1465
1477
|
component.status = status;
|
|
1466
1478
|
addToUpdates(component.meta.did, status);
|
|
1479
|
+
logger.info('will sync status from pm2', { did, status, oldStatus, componentDid: component.meta.did });
|
|
1467
1480
|
}
|
|
1468
1481
|
} catch {
|
|
1469
1482
|
if (
|
|
@@ -1488,6 +1501,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
1488
1501
|
// iterate updates
|
|
1489
1502
|
if (updates.size > 0) {
|
|
1490
1503
|
for (const [status, dids] of updates) {
|
|
1504
|
+
logger.info('sync status from pm2', { did, status, componentDids: dids });
|
|
1491
1505
|
await states.blocklet.setBlockletStatus(did, status, { componentDids: dids });
|
|
1492
1506
|
}
|
|
1493
1507
|
}
|
|
@@ -2493,6 +2507,8 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
2493
2507
|
|
|
2494
2508
|
// update state
|
|
2495
2509
|
await states.blocklet.upgradeBlocklet({ meta, source, deployedFrom, children });
|
|
2510
|
+
// ensure component status is upgrading
|
|
2511
|
+
await states.blocklet.setBlockletStatus(did, BlockletStatus.upgrading, { componentDids });
|
|
2496
2512
|
await this._setConfigsFromMeta(did);
|
|
2497
2513
|
|
|
2498
2514
|
// should ensure blocklet integrity
|
|
@@ -2533,14 +2549,14 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
2533
2549
|
|
|
2534
2550
|
logger.info('updated blocklet for upgrading', { did, version, source, name });
|
|
2535
2551
|
|
|
2536
|
-
const status =
|
|
2537
|
-
oldBlocklet.status === BlockletStatus.installed ? BlockletStatus.installed : BlockletStatus.stopped;
|
|
2538
|
-
await states.blocklet.setBlockletStatus(did, status, { componentDids });
|
|
2539
|
-
|
|
2540
|
-
// start new process
|
|
2541
2552
|
if (oldBlocklet.status === BlockletStatus.running) {
|
|
2553
|
+
// start new process
|
|
2542
2554
|
await this.start({ did, componentDids }, context);
|
|
2543
2555
|
logger.info('started blocklet for upgrading', { did, version });
|
|
2556
|
+
} else {
|
|
2557
|
+
const status =
|
|
2558
|
+
oldBlocklet.status === BlockletStatus.installed ? BlockletStatus.installed : BlockletStatus.stopped;
|
|
2559
|
+
await states.blocklet.setBlockletStatus(did, status, { componentDids });
|
|
2544
2560
|
}
|
|
2545
2561
|
|
|
2546
2562
|
blocklet = await this.getBlocklet(did, context);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.11-next-
|
|
6
|
+
"version": "1.16.11-next-48aec895",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/auth": "1.16.11-next-
|
|
23
|
-
"@abtnode/certificate-manager": "1.16.11-next-
|
|
24
|
-
"@abtnode/constant": "1.16.11-next-
|
|
25
|
-
"@abtnode/cron": "1.16.11-next-
|
|
26
|
-
"@abtnode/logger": "1.16.11-next-
|
|
27
|
-
"@abtnode/models": "1.16.11-next-
|
|
28
|
-
"@abtnode/queue": "1.16.11-next-
|
|
29
|
-
"@abtnode/rbac": "1.16.11-next-
|
|
30
|
-
"@abtnode/router-provider": "1.16.11-next-
|
|
31
|
-
"@abtnode/static-server": "1.16.11-next-
|
|
32
|
-
"@abtnode/timemachine": "1.16.11-next-
|
|
33
|
-
"@abtnode/util": "1.16.11-next-
|
|
22
|
+
"@abtnode/auth": "1.16.11-next-48aec895",
|
|
23
|
+
"@abtnode/certificate-manager": "1.16.11-next-48aec895",
|
|
24
|
+
"@abtnode/constant": "1.16.11-next-48aec895",
|
|
25
|
+
"@abtnode/cron": "1.16.11-next-48aec895",
|
|
26
|
+
"@abtnode/logger": "1.16.11-next-48aec895",
|
|
27
|
+
"@abtnode/models": "1.16.11-next-48aec895",
|
|
28
|
+
"@abtnode/queue": "1.16.11-next-48aec895",
|
|
29
|
+
"@abtnode/rbac": "1.16.11-next-48aec895",
|
|
30
|
+
"@abtnode/router-provider": "1.16.11-next-48aec895",
|
|
31
|
+
"@abtnode/static-server": "1.16.11-next-48aec895",
|
|
32
|
+
"@abtnode/timemachine": "1.16.11-next-48aec895",
|
|
33
|
+
"@abtnode/util": "1.16.11-next-48aec895",
|
|
34
34
|
"@arcblock/did": "1.18.80",
|
|
35
35
|
"@arcblock/did-auth": "1.18.80",
|
|
36
36
|
"@arcblock/did-ext": "^1.18.80",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@arcblock/pm2-events": "^0.0.5",
|
|
42
42
|
"@arcblock/validator": "^1.18.80",
|
|
43
43
|
"@arcblock/vc": "1.18.80",
|
|
44
|
-
"@blocklet/constant": "1.16.11-next-
|
|
45
|
-
"@blocklet/meta": "1.16.11-next-
|
|
46
|
-
"@blocklet/sdk": "1.16.11-next-
|
|
44
|
+
"@blocklet/constant": "1.16.11-next-48aec895",
|
|
45
|
+
"@blocklet/meta": "1.16.11-next-48aec895",
|
|
46
|
+
"@blocklet/sdk": "1.16.11-next-48aec895",
|
|
47
47
|
"@did-space/client": "^0.2.113",
|
|
48
48
|
"@fidm/x509": "^1.2.1",
|
|
49
49
|
"@ocap/mcrypto": "1.18.80",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"express": "^4.18.2",
|
|
97
97
|
"jest": "^27.5.1"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "81aed0ba08844b437507865581dd3f8ffd0aa04f"
|
|
100
100
|
}
|