Skip to content

Commit 0cef886

Browse files
committed
fix: Add NodeStatus service README
Add a README for EntglDb.Services.NodeStatus describing the diagnostic service that lets peers query runtime status (uptime, known peers, version). Documents wire types (1000 request / 1001 response), installation, quick-start registration (`AddEntglDbNodeStatus`) and example `QueryAsync` usage. Explains server `NodeStatusHandler` and client `INodeStatusService`/`NodeStatusClient`, and notes the service shares the existing EntglDb TCP connection.
1 parent 246e46b commit 0cef886

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# EntglDb.Services.NodeStatus
2+
3+
Diagnostic service for the **EntglDb** P2P mesh network. Allows any node to query the runtime status of remote peers — uptime, known peer addresses, and service version — over the shared TCP connection.
4+
5+
Wire types: **1000** (request) / **1001** (response).
6+
7+
## Installation
8+
9+
```bash
10+
dotnet add package EntglDb.Network
11+
dotnet add package EntglDb.Services.NodeStatus
12+
```
13+
14+
## Quick Start
15+
16+
```csharp
17+
builder.Services
18+
.AddEntglDbNetwork<MyConfigProvider>()
19+
.AddEntglDbNodeStatus(); // registers server handler + INodeStatusService client
20+
```
21+
22+
Query a remote peer:
23+
24+
```csharp
25+
var status = await nodeStatusService.QueryAsync("192.168.1.10:9000", ct);
26+
Console.WriteLine($"Node {status.NodeId} up for {status.Uptime}, knows {status.KnownPeerAddresses.Count} peers");
27+
```
28+
29+
## How It Works
30+
31+
`AddEntglDbNodeStatus()` registers two things:
32+
33+
- **`NodeStatusHandler`** (server side) — handles incoming `NodeStatusReq` messages (wire type 1000) and replies with a snapshot of the local node's state.
34+
- **`INodeStatusService`** / `NodeStatusClient` (client side) — sends a `NodeStatusReq` to the target peer via `IPeerMessenger` and maps the response to `NodeStatusInfo`.
35+
36+
The connection is shared with all other EntglDb services (sync, file transfer, etc.) — no extra socket is opened.

0 commit comments

Comments
 (0)