IGarbageCollectionRuntime Interface
Defines the APIs for the runtime object to be passed to the garbage collector.
Signature
export interface IGarbageCollectionRuntime
Methods
Method | Return Type | Description |
---|---|---|
closeFn(error) | void | Called when the runtime should close because of an error. |
deleteUnusedRoutes(unusedRoutes) | void | After GC has run, called to delete objects in the runtime whose routes are unused. |
getCurrentReferenceTimestampMs() | number | undefined | Returns a referenced timestamp to be used to track unreferenced nodes. |
getGCData(fullGC) | Promise<IGarbageCollectionData> | Returns the garbage collection data of the runtime. |
getNodeType(nodePath) | GCNodeType | Returns the type of the GC node. |
updateStateBeforeGC() | Promise<void> | Before GC runs, called to notify the runtime to update any pending GC state. |
updateUsedRoutes(usedRoutes, gcTimestamp) | void | After GC has run, called to notify the runtime of routes that are used in it. |
Method Details
closeFn
Called when the runtime should close because of an error.
Signature
closeFn(error?: ICriticalContainerError): void;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
error | optional | ICriticalContainerError |
deleteUnusedRoutes
After GC has run, called to delete objects in the runtime whose routes are unused.
Signature
deleteUnusedRoutes(unusedRoutes: string[]): void;
Parameters
Parameter | Type | Description |
---|---|---|
unusedRoutes | string[] |
getCurrentReferenceTimestampMs
Returns a referenced timestamp to be used to track unreferenced nodes.
Signature
getCurrentReferenceTimestampMs(): number | undefined;
Returns
Return type: number | undefined
getGCData
Returns the garbage collection data of the runtime.
Signature
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
fullGC | optional | boolean |
Returns
Return type: Promise<IGarbageCollectionData>
getNodeType
Returns the type of the GC node.
Signature
getNodeType(nodePath: string): GCNodeType;
Parameters
Parameter | Type | Description |
---|---|---|
nodePath | string |
Returns
Return type: GCNodeType
updateStateBeforeGC
Before GC runs, called to notify the runtime to update any pending GC state.
Signature
updateStateBeforeGC(): Promise<void>;
Returns
Return type: Promise<void>
updateUsedRoutes
After GC has run, called to notify the runtime of routes that are used in it.
Signature
updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
usedRoutes | string[] | ||
gcTimestamp | optional | number |