@@ -20,10 +20,7 @@ use axum_server::tls_rustls::RustlsConfig;
2020use derive_builder:: Builder ;
2121use dynamo_runtime:: logging:: make_request_span;
2222use dynamo_runtime:: metrics:: prometheus_names:: name_prefix;
23- use dynamo_runtime:: storage:: key_value_store:: EtcdStore ;
24- use dynamo_runtime:: storage:: key_value_store:: KeyValueStore ;
25- use dynamo_runtime:: storage:: key_value_store:: MemoryStore ;
26- use dynamo_runtime:: transports:: etcd;
23+ use dynamo_runtime:: storage:: key_value_store:: KeyValueStoreManager ;
2724use std:: net:: SocketAddr ;
2825use tokio:: task:: JoinHandle ;
2926use tokio_util:: sync:: CancellationToken ;
@@ -33,8 +30,7 @@ use tower_http::trace::TraceLayer;
3330pub struct State {
3431 metrics : Arc < Metrics > ,
3532 manager : Arc < ModelManager > ,
36- etcd_client : Option < etcd:: Client > ,
37- store : Arc < dyn KeyValueStore > ,
33+ store : KeyValueStoreManager ,
3834 flags : StateFlags ,
3935}
4036
@@ -75,12 +71,11 @@ impl StateFlags {
7571}
7672
7773impl State {
78- pub fn new ( manager : Arc < ModelManager > ) -> Self {
74+ pub fn new ( manager : Arc < ModelManager > , store : KeyValueStoreManager ) -> Self {
7975 Self {
8076 manager,
8177 metrics : Arc :: new ( Metrics :: default ( ) ) ,
82- etcd_client : None ,
83- store : Arc :: new ( MemoryStore :: new ( ) ) ,
78+ store,
8479 flags : StateFlags {
8580 chat_endpoints_enabled : AtomicBool :: new ( false ) ,
8681 cmpl_endpoints_enabled : AtomicBool :: new ( false ) ,
@@ -90,20 +85,6 @@ impl State {
9085 }
9186 }
9287
93- pub fn new_with_etcd ( manager : Arc < ModelManager > , etcd_client : etcd:: Client ) -> Self {
94- Self {
95- manager,
96- metrics : Arc :: new ( Metrics :: default ( ) ) ,
97- store : Arc :: new ( EtcdStore :: new ( etcd_client. clone ( ) ) ) ,
98- etcd_client : Some ( etcd_client) ,
99- flags : StateFlags {
100- chat_endpoints_enabled : AtomicBool :: new ( false ) ,
101- cmpl_endpoints_enabled : AtomicBool :: new ( false ) ,
102- embeddings_endpoints_enabled : AtomicBool :: new ( false ) ,
103- responses_endpoints_enabled : AtomicBool :: new ( false ) ,
104- } ,
105- }
106- }
10788 /// Get the Prometheus [`Metrics`] object which tracks request counts and inflight requests
10889 pub fn metrics_clone ( & self ) -> Arc < Metrics > {
10990 self . metrics . clone ( )
@@ -117,12 +98,8 @@ impl State {
11798 self . manager . clone ( )
11899 }
119100
120- pub fn etcd_client ( & self ) -> Option < & etcd:: Client > {
121- self . etcd_client . as_ref ( )
122- }
123-
124- pub fn store ( & self ) -> Arc < dyn KeyValueStore > {
125- self . store . clone ( )
101+ pub fn store ( & self ) -> & KeyValueStoreManager {
102+ & self . store
126103 }
127104
128105 // TODO
@@ -186,8 +163,8 @@ pub struct HttpServiceConfig {
186163 #[ builder( default = "None" ) ]
187164 request_template : Option < RequestTemplate > ,
188165
189- #[ builder( default = "None" ) ]
190- etcd_client : Option < etcd :: Client > ,
166+ #[ builder( default ) ]
167+ store : KeyValueStoreManager ,
191168
192169 // DEPRECATED: To be removed after custom backends migrate to Dynamo backend.
193170 #[ builder( default = "None" ) ]
@@ -335,10 +312,7 @@ impl HttpServiceConfigBuilder {
335312 let config: HttpServiceConfig = self . build_internal ( ) ?;
336313
337314 let model_manager = Arc :: new ( ModelManager :: new ( ) ) ;
338- let state = match config. etcd_client {
339- Some ( etcd_client) => Arc :: new ( State :: new_with_etcd ( model_manager, etcd_client) ) ,
340- None => Arc :: new ( State :: new ( model_manager) ) ,
341- } ;
315+ let state = Arc :: new ( State :: new ( model_manager, config. store ) ) ;
342316 state
343317 . flags
344318 . set ( & EndpointType :: Chat , config. enable_chat_endpoints ) ;
@@ -422,11 +396,6 @@ impl HttpServiceConfigBuilder {
422396 self
423397 }
424398
425- pub fn with_etcd_client ( mut self , etcd_client : Option < etcd:: Client > ) -> Self {
426- self . etcd_client = Some ( etcd_client) ;
427- self
428- }
429-
430399 // DEPRECATED: To be removed after custom backends migrate to Dynamo backend.
431400 pub fn with_custom_backend_config (
432401 mut self ,
0 commit comments