Danish Arora d464af3645
feat: node and protocols health (#2080)
* feat: introduce HealthManager

* feat: make health accessible on Waku object

* feat: update health from protocols

* chore: add access modifiers to healthmanager

* feat: use a HealthManager singleton

* chore: add tests for Filter, LightPush and Store

* feat: add overall node health

* chore: update protocol health to consider Store protocol

* chore: setup generic test utils instead of using filter utils

* tests: add a health status matrix check from 0-3

* chore: increase timeout for failing tests in CI
tests pass locally without an increased timeout, but fail in CI

* chore: move name inference to HealthManager

* tests: abstract away node creation and teardown utils

* fix: import
2024-07-27 18:27:54 +05:30

55 lines
1.3 KiB
TypeScript

import type { PeerId, Stream } from "@libp2p/interface";
import type { MultiaddrInput } from "@multiformats/multiaddr";
import { IConnectionManager } from "./connection_manager.js";
import type { IFilterSDK } from "./filter.js";
import { IHealthManager } from "./health_manager.js";
import type { Libp2p } from "./libp2p.js";
import type { ILightPushSDK } from "./light_push.js";
import { Protocols } from "./protocols.js";
import type { IRelay } from "./relay.js";
import type { IStoreSDK } from "./store.js";
export interface Waku {
libp2p: Libp2p;
relay?: IRelay;
store?: IStoreSDK;
filter?: IFilterSDK;
lightPush?: ILightPushSDK;
connectionManager: IConnectionManager;
dial(peer: PeerId | MultiaddrInput, protocols?: Protocols[]): Promise<Stream>;
start(): Promise<void>;
stop(): Promise<void>;
isStarted(): boolean;
isConnected(): boolean;
health: IHealthManager;
}
export interface LightNode extends Waku {
relay: undefined;
store: IStoreSDK;
filter: IFilterSDK;
lightPush: ILightPushSDK;
}
export interface RelayNode extends Waku {
relay: IRelay;
store: undefined;
filter: undefined;
lightPush: undefined;
}
export interface FullNode extends Waku {
relay: IRelay;
store: IStoreSDK;
filter: IFilterSDK;
lightPush: ILightPushSDK;
}