11// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4- use crate :: kv_router:: {
5- KV_EVENT_SUBJECT , KV_METRICS_SUBJECT ,
6- indexer:: { RouterEvent , compute_block_hash_for_seq} ,
7- protocols:: * ,
8- scoring:: LoadEvent ,
9- } ;
10- use dynamo_runtime:: metrics:: { MetricsHierarchy , prometheus_names:: kvstats} ;
11- use dynamo_runtime:: traits:: { DistributedRuntimeProvider , events:: EventPublisher } ;
12- use dynamo_runtime:: {
13- Result ,
14- component:: { Component , Namespace } ,
15- transports:: nats:: { NatsQueue , QUEUE_NAME , Slug } ,
16- } ;
4+ use std:: fmt;
5+ use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
176use std:: sync:: { Arc , OnceLock } ;
18- use tokio:: sync:: mpsc;
19- use tokio_util:: sync:: CancellationToken ;
7+ use std:: time:: Duration ;
208
9+ use anyhow:: Result ;
2110use rmp_serde as rmps;
2211use serde:: Deserialize ;
2312use serde:: Serialize ;
2413use serde:: de:: { self , Deserializer , IgnoredAny , MapAccess , SeqAccess , Visitor } ;
25- use std:: fmt;
26- use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
27- use std:: time:: Duration ;
14+ use tokio:: sync:: mpsc;
15+ use tokio_util:: sync:: CancellationToken ;
2816use zeromq:: { Socket , SocketRecv , SubSocket } ;
2917
18+ use dynamo_runtime:: metrics:: { MetricsHierarchy , prometheus_names:: kvstats} ;
19+ use dynamo_runtime:: traits:: { DistributedRuntimeProvider , events:: EventPublisher } ;
20+ use dynamo_runtime:: {
21+ component:: { Component , Namespace } ,
22+ transports:: nats:: { NatsQueue , QUEUE_NAME , Slug } ,
23+ } ;
24+
25+ use crate :: kv_router:: {
26+ KV_EVENT_SUBJECT , KV_METRICS_SUBJECT ,
27+ indexer:: { RouterEvent , compute_block_hash_for_seq} ,
28+ protocols:: * ,
29+ scoring:: LoadEvent ,
30+ } ;
31+
3032// -------------------------------------------------------------------------
3133// KV Event Publishers -----------------------------------------------------
3234// -------------------------------------------------------------------------
@@ -1025,7 +1027,7 @@ mod tests_startup_helpers {
10251027 & self ,
10261028 event_name : impl AsRef < str > + Send + Sync ,
10271029 event : & ( impl serde:: Serialize + Send + Sync ) ,
1028- ) -> dynamo_runtime :: Result < ( ) > {
1030+ ) -> anyhow :: Result < ( ) > {
10291031 let bytes = rmp_serde:: to_vec ( event) . unwrap ( ) ;
10301032 self . published
10311033 . lock ( )
@@ -1038,7 +1040,7 @@ mod tests_startup_helpers {
10381040 & self ,
10391041 event_name : impl AsRef < str > + Send + Sync ,
10401042 bytes : Vec < u8 > ,
1041- ) -> dynamo_runtime :: Result < ( ) > {
1043+ ) -> anyhow :: Result < ( ) > {
10421044 self . published
10431045 . lock ( )
10441046 . unwrap ( )
0 commit comments