harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
63 lines (62 loc) • 2.14 kB
TypeScript
/**
* Cross-Thread Component Status Collection
*
* This module handles collecting component status information from all worker threads
* and aggregating it into a unified view.
*/
import { ComponentStatusRegistry } from './ComponentStatusRegistry.ts';
import { type ComponentStatusSummary, type AggregatedComponentStatus } from './types.ts';
/**
* CrossThreadStatusCollector Class
* Handles collection of component status from all worker threads
*/
export declare class CrossThreadStatusCollector {
private awaitingResponses;
private responseCheckers;
private nextRequestId;
private listenerAttached;
private readonly timeout;
private cleanupTimer;
constructor(timeoutMs?: number);
/**
* Attach the message listener for cross-thread responses
* This is done once per collector instance to avoid duplicate listeners
*/
private attachListener;
/**
* Schedule cleanup of stale requests if needed
*/
private scheduleCleanup;
/**
* Collect component status information from all threads
* Returns a Map with component names namespaced by worker index
*/
collect(registry: ComponentStatusRegistry): Promise<Map<string, ComponentStatusSummary>>;
/**
* Get status from local thread only (fallback when cross-thread collection fails)
*/
private getLocalStatusOnly;
/**
* Clean up any pending requests and timers (useful for testing)
*/
cleanup(): void;
}
/**
* StatusAggregator Class
* Handles aggregation of component statuses from multiple threads
*/
export declare class StatusAggregator {
/**
* Aggregate component statuses from multiple threads into aggregated view
*/
static aggregate(allStatuses: Map<string, ComponentStatusSummary>): Map<string, AggregatedComponentStatus>;
/**
* Aggregate status entries for a single component across threads
*/
private static aggregateComponentGroup;
/**
* Determine overall status based on priority
*/
private static determineOverallStatus;
}
export declare const crossThreadCollector: CrossThreadStatusCollector;