Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,20 @@ class EagerEngineScheduler {
class ClusterManager {
private nodes: Map<string, NodeInfo>;
private localId: string;
private localAddr: string;

constructor(localId: string, localAddr: string) {
constructor(localId: string, _localAddr: string) {
this.nodes = new Map();
this.localId = localId;
this.localAddr = localAddr;
}

getAllOtherNodes(): NodeInfo[] {
return this.getAllNodes().filter((node) => node.id !== this.localId);
}

getAllNodes(): NodeInfo[] {
return Array.from(this.nodes.values());
}

getAllOtherNodes(): NodeInfo[] {
return this.getAllNodes().filter((node) => node.id !== this.localId);
}

getAllNodeInfo(): Node[] {
return this.getAllNodes().map((node) => ({ id: node.id, addr: node.addr }));
}
Expand Down Expand Up @@ -243,13 +241,11 @@ interface NetworkHandlerCallbacks {

class NetworkHandler {
private server: grpc.Server;
private id: string;
private addr: string;
private callbacks: NetworkHandlerCallbacks;

constructor(addr: string, id: string, callbacks: NetworkHandlerCallbacks) {
constructor(addr: string, _id: string, callbacks: NetworkHandlerCallbacks) {
this.server = new grpc.Server();
this.id = id;
this.addr = addr;
this.callbacks = callbacks;
}
Expand Down Expand Up @@ -419,7 +415,7 @@ class EagerNode {

await this.syncDataWithNode(nodeClient);

console.log(`Joined node: ${node.id} at ${node.addr}`);
console.log(`Joining node: ${node.id} at ${node.addr}`);
}
}

Expand All @@ -439,7 +435,7 @@ class EagerNode {
try {
await this.networkHandler.callLeave(currentNode, node.client);
this.clusterManager.removeNode(node.id);
console.log(`Left node: ${node.id}`);
console.log(`Leaving node: ${node.id}`);
} catch (error) {
console.error(`Failed to leave node ${node.id}:`, error);
}
Expand Down Expand Up @@ -505,8 +501,8 @@ class EagerNode {
for (const node of otherNodes) {
try {
await this.networkHandler.callPushData(results, node.client);
} catch (error) {
console.error(`Failed to push data to node ${node.id}:`, error);
} catch (_error) {
// Silent failure when pushing data to other nodes
}
}
}
Expand All @@ -523,8 +519,8 @@ class EagerNode {
this.engineScheduler.addDataBatch(remoteData);
console.log(`Synced ${remoteData.length} data items from remote`);
}
} catch (error) {
console.error("Data sync failed:", error);
} catch (_error) {
// Silent failure when syncing data
}
}

Expand All @@ -547,8 +543,8 @@ class EagerNode {
for (const node of otherNodes) {
try {
await this.networkHandler.callPushData([formatted], node.client);
} catch (error) {
console.error(`Failed to push input to node ${node.id}:`, error);
} catch (_error) {
// Silent failure when pushing data to other nodes
}
}
}
Expand Down Expand Up @@ -586,10 +582,6 @@ class EagerNode {
console.log("========================\n");
});
}

getNodeInfo(): { id: string; addr: string } {
return { id: this.id, addr: this.addr };
}
}

function isIntegerString(str: string): boolean {
Expand Down