Skip to content

Commit

Permalink
discojs/federated: rm unused ServerStatistics
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed May 28, 2024
1 parent c5bf116 commit 0eb9626
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
21 changes: 2 additions & 19 deletions discojs/src/client/federated/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export type MessageFederated =
ClientConnected |
SendPayload |
ReceiveServerPayload |
RequestServerStatistics |
ReceiveServerStatistics |
ReceiveServerMetadata |
AssignNodeID

Expand All @@ -22,13 +20,6 @@ export interface ReceiveServerPayload {
payload: weights.Encoded
round: number
}
export interface RequestServerStatistics {
type: type.RequestServerStatistics
}
export interface ReceiveServerStatistics {
type: type.ReceiveServerStatistics
statistics: Record<string, number>
}
export interface ReceiveServerMetadata {
type: type.ReceiveServerMetadata
nodeId: client.NodeID
Expand All @@ -45,20 +36,12 @@ export function isMessageFederated (raw: unknown): raw is MessageFederated {

switch (raw.type) {
case type.ClientConnected:
return true
case type.SendPayload:
return true
case type.ReceiveServerPayload:
return true
case type.RequestServerStatistics:
return true
case type.ReceiveServerStatistics:
return true
case type.ReceiveServerMetadata:
return true
case type.AssignNodeID:
return true
default:
return false
}

return false
}
2 changes: 0 additions & 2 deletions discojs/src/client/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export enum type {
SendPayload,
ReceiveServerMetadata,
ReceiveServerPayload,
RequestServerStatistics,
ReceiveServerStatistics,
}

export interface ClientConnected {
Expand Down
15 changes: 0 additions & 15 deletions server/src/router/federated/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,6 @@ export class Federated extends Server {
console.info(`dropped contribution from client ${clientId} for round ${round}`)
return // TODO what to answer?
}
} else if (msg.type === MessageTypes.ReceiveServerStatistics) {
const statistics = this.informants
.get(task.id)
?.getAllStatistics()

const msg: messages.ReceiveServerStatistics = {
type: MessageTypes.ReceiveServerStatistics,
statistics: statistics ?? {}
}

ws.send(msgpack.encode(msg))
} else if (msg.type === MessageTypes.RequestServerStatistics) {
this.logsAppend(task.id, clientId, MessageTypes.ReceiveServerPayload, 0)

this.createPromiseForWeights(task.id, aggregator, ws)
} else if (msg.type === MessageTypes.ReceiveServerMetadata) {
const { key, round } = msg

Expand Down

0 comments on commit 0eb9626

Please sign in to comment.