@modelprofile.com/browser-runtime 3.2.0 → 4.0.0
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/changelog.md +17 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.artifactstore.d.ts +4 -1
- package/dist_ts/classes.artifactstore.js +42 -11
- package/dist_ts/classes.runtime.d.ts +8 -5
- package/dist_ts/classes.runtime.js +126 -48
- package/dist_ts/classes.runtimeownership.d.ts +102 -0
- package/dist_ts/classes.runtimeownership.js +1230 -0
- package/dist_ts/internal.testing.d.ts +2 -0
- package/dist_ts/internal.testing.js +1 -1
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +3 -2
- package/readme.hints.md +7 -0
- package/readme.md +23 -4
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.artifactstore.ts +51 -14
- package/ts/classes.runtime.ts +132 -48
- package/ts/classes.runtimeownership.ts +1393 -0
- package/ts/internal.testing.ts +2 -0
- package/ts/plugins.ts +2 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type TOwnershipGenerationRemovalReason = 'stale' | 'startup-failure' | 'stop';
|
|
2
|
+
export interface IBrowserRuntimeOwnershipTestingOptions {
|
|
3
|
+
procRoot?: string;
|
|
4
|
+
now?(): number;
|
|
5
|
+
beforeMetadataPublication?(): Promise<void>;
|
|
6
|
+
beforeGenerationRemoval?(reason: TOwnershipGenerationRemovalReason): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface IBrowserRuntimeOwnershipOptions {
|
|
9
|
+
runtimeDirectory: string;
|
|
10
|
+
uid: number;
|
|
11
|
+
testing?: IBrowserRuntimeOwnershipTestingOptions;
|
|
12
|
+
onOwnershipLost?(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface IBrowserRuntimeGeneration {
|
|
15
|
+
generationId: string;
|
|
16
|
+
generationDirectory: string;
|
|
17
|
+
profileRoot: string;
|
|
18
|
+
artifactRoot: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class BrowserRuntimeOwnership {
|
|
21
|
+
readonly runtimeDirectory: string;
|
|
22
|
+
readonly lockPath: string;
|
|
23
|
+
readonly anchorDirectory: string;
|
|
24
|
+
private readonly generationsRoot;
|
|
25
|
+
private readonly legacyProfileRoot;
|
|
26
|
+
private readonly legacyArtifactRoot;
|
|
27
|
+
private readonly uid;
|
|
28
|
+
private readonly procRoot;
|
|
29
|
+
private readonly now;
|
|
30
|
+
private readonly beforeMetadataPublication?;
|
|
31
|
+
private readonly beforeGenerationRemoval?;
|
|
32
|
+
private readonly onOwnershipLost?;
|
|
33
|
+
private directoryHandle?;
|
|
34
|
+
private directoryIdentity?;
|
|
35
|
+
private anchorDirectoryHandle?;
|
|
36
|
+
private anchorDirectoryIdentity?;
|
|
37
|
+
private anchorIdentity?;
|
|
38
|
+
private namedMutex?;
|
|
39
|
+
private namedMutexLease?;
|
|
40
|
+
private lockHandle?;
|
|
41
|
+
private lockIdentity?;
|
|
42
|
+
private createdLock;
|
|
43
|
+
private leaseLost;
|
|
44
|
+
private metadata?;
|
|
45
|
+
private generation?;
|
|
46
|
+
private acquirePromise?;
|
|
47
|
+
private releasePromise?;
|
|
48
|
+
constructor(optionsArg: IBrowserRuntimeOwnershipOptions);
|
|
49
|
+
get owned(): boolean;
|
|
50
|
+
get cleanupPending(): boolean;
|
|
51
|
+
acquire(): Promise<IBrowserRuntimeGeneration>;
|
|
52
|
+
release(reasonArg?: Exclude<TOwnershipGenerationRemovalReason, 'stale'>): Promise<void>;
|
|
53
|
+
/** @internal */
|
|
54
|
+
assertCurrentOwnership(): Promise<void>;
|
|
55
|
+
private acquireInternal;
|
|
56
|
+
private openAndValidateRuntimeDirectory;
|
|
57
|
+
private openAndValidateAnchorDirectory;
|
|
58
|
+
private acquireNativeLease;
|
|
59
|
+
private ensurePermanentAnchor;
|
|
60
|
+
private assertPrivateAnchorStat;
|
|
61
|
+
private assertNativeAnchorCurrent;
|
|
62
|
+
/** @internal */
|
|
63
|
+
forceOwnershipLossForTesting(): Promise<void>;
|
|
64
|
+
private openAndClassifyLock;
|
|
65
|
+
private readPrivateLockPathStat;
|
|
66
|
+
private validateLockHandle;
|
|
67
|
+
private assertPrivateLockStat;
|
|
68
|
+
private assertLockPathCurrent;
|
|
69
|
+
private adoptCreatedLockLayout;
|
|
70
|
+
private unlinkCreatedLock;
|
|
71
|
+
private adoptLegacyLock;
|
|
72
|
+
private legacyLockPredatesCurrentBoot;
|
|
73
|
+
private readBootTimeNs;
|
|
74
|
+
private reclaimMetadataGeneration;
|
|
75
|
+
private publishGeneration;
|
|
76
|
+
private releaseInternal;
|
|
77
|
+
private closePassiveHandles;
|
|
78
|
+
private closeOwnershipHandles;
|
|
79
|
+
private readMetadata;
|
|
80
|
+
private writeMetadata;
|
|
81
|
+
private assertMetadataDirectoryIdentity;
|
|
82
|
+
private inspectLegacyLockDescriptors;
|
|
83
|
+
private inspectProfileProcesses;
|
|
84
|
+
private listOwnedProcessIds;
|
|
85
|
+
private processStillExists;
|
|
86
|
+
private parseProcessUidState;
|
|
87
|
+
private processIsZombie;
|
|
88
|
+
private readBootId;
|
|
89
|
+
private readBoundedFile;
|
|
90
|
+
private readBoundedBuffer;
|
|
91
|
+
private generationPath;
|
|
92
|
+
private pathIsWithin;
|
|
93
|
+
private assertRuntimeEntries;
|
|
94
|
+
private assertRuntimeDirectoryCurrent;
|
|
95
|
+
private ensurePrivateDirectory;
|
|
96
|
+
private validateOptionalPrivateDirectory;
|
|
97
|
+
private validateOptionalGeneration;
|
|
98
|
+
private removePrivateDirectory;
|
|
99
|
+
private readOptionalDirectoryEntries;
|
|
100
|
+
private syncOptionalDirectory;
|
|
101
|
+
private syncDirectory;
|
|
102
|
+
}
|