1use crabllm_core::{Extension, GatewayConfig, Storage};
2use crabllm_provider::ProviderRegistry;
3use std::{
4 collections::HashMap,
5 sync::{Arc, RwLock},
6};
7
8pub struct AppState<S: Storage> {
10 pub registry: ProviderRegistry,
11 pub client: reqwest::Client,
12 pub config: GatewayConfig,
13 pub extensions: Arc<Vec<Box<dyn Extension>>>,
14 pub storage: Arc<S>,
15 pub key_map: Arc<RwLock<HashMap<String, String>>>,
18}
19
20impl<S: Storage> Clone for AppState<S> {
21 fn clone(&self) -> Self {
22 Self {
23 registry: self.registry.clone(),
24 client: self.client.clone(),
25 config: self.config.clone(),
26 extensions: self.extensions.clone(),
27 storage: self.storage.clone(),
28 key_map: self.key_map.clone(),
29 }
30 }
31}