mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-30 16:33:14 +00:00
* Move waku.nim from waku/factory to under waku/ * remove unused * Realize Kernel API in scope of Waku class * Refactor waku/api into messaging_client, waku/api/types and api_conf into logos_delivery/api * Make liblogosdelivery and wakunode2 compile, remove waku/api.nim as it was just a import orchestrator * make test compile and run * Reconcile master's new send tests to LogosDelivery API after rebase master commits #3965/#3669-followup added two test cases (Edge lightpush delivery #3847, store-validation timeout) written against the removed waku/api.nim createNode helper. Rewrite them to the LogosDelivery shape: createNode -> LogosDelivery.new, node.node -> node.waku.node, node.brokerCtx -> node.waku.brokerCtx, node.send -> node.messagingClient.send, and drop the now-implicit mountMessagingClient calls (LogosDelivery.new mounts the client internally).
20 lines
634 B
Nim
20 lines
634 B
Nim
import chronos, results, std/strutils
|
|
from logos_delivery/api/types import ConnectionStatus
|
|
|
|
export ConnectionStatus
|
|
|
|
const HealthyThreshold* = 2
|
|
## Minimum peers required per service protocol for a "Connected" status (excluding Relay).
|
|
|
|
proc init*(
|
|
t: typedesc[ConnectionStatus], strRep: string
|
|
): Result[ConnectionStatus, string] =
|
|
try:
|
|
let status = parseEnum[ConnectionStatus](strRep)
|
|
return ok(status)
|
|
except ValueError:
|
|
return err("Invalid ConnectionStatus string representation: " & strRep)
|
|
|
|
type ConnectionStatusChangeHandler* =
|
|
proc(status: ConnectionStatus): Future[void] {.gcsafe, raises: [Defect].}
|