File tree Expand file tree Collapse file tree 8 files changed +13
-11
lines changed
factor-key-value-azure/src
factor-key-value-redis/src
factor-outbound-redis/src Expand file tree Collapse file tree 8 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ use spin_key_value_azure::{
5
5
} ;
6
6
7
7
/// A key-value store that uses Azure Cosmos as the backend.
8
+ #[ derive( Default ) ]
8
9
pub struct AzureKeyValueStore {
9
10
_priv : ( ) ,
10
11
}
11
12
12
13
impl AzureKeyValueStore {
13
14
/// Creates a new `AzureKeyValueStore`.
14
15
pub fn new ( ) -> Self {
15
- Self { _priv : ( ) }
16
+ Self :: default ( )
16
17
}
17
18
}
18
19
Original file line number Diff line number Diff line change @@ -3,14 +3,15 @@ use spin_factor_key_value::runtime_config::spin::MakeKeyValueStore;
3
3
use spin_key_value_redis:: KeyValueRedis ;
4
4
5
5
/// A key-value store that uses Redis as the backend.
6
+ #[ derive( Default ) ]
6
7
pub struct RedisKeyValueStore {
7
8
_priv : ( ) ,
8
9
}
9
10
10
11
impl RedisKeyValueStore {
11
12
/// Creates a new `RedisKeyValueStore`.
12
13
pub fn new ( ) -> Self {
13
- Self { _priv : ( ) }
14
+ Self :: default ( )
14
15
}
15
16
}
16
17
Original file line number Diff line number Diff line change @@ -8,13 +8,14 @@ use spin_factors::{
8
8
} ;
9
9
10
10
/// The [`Factor`] for `fermyon:spin/outbound-redis`.
11
+ #[ derive( Default ) ]
11
12
pub struct OutboundRedisFactor {
12
13
_priv : ( ) ,
13
14
}
14
15
15
16
impl OutboundRedisFactor {
16
17
pub fn new ( ) -> Self {
17
- Self { _priv : ( ) }
18
+ Self :: default ( )
18
19
}
19
20
}
20
21
Original file line number Diff line number Diff line change @@ -44,9 +44,10 @@ impl InstanceState {
44
44
fn get_connection (
45
45
& self ,
46
46
connection : Resource < v2:: Connection > ,
47
- ) -> Result < & Box < dyn Connection > , v2:: Error > {
47
+ ) -> Result < & dyn Connection , v2:: Error > {
48
48
self . connections
49
49
. get ( connection. rep ( ) )
50
+ . map ( |conn| conn. as_ref ( ) )
50
51
. ok_or ( v2:: Error :: InvalidConnection )
51
52
}
52
53
}
Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ impl FactorRuntimeConfigSource<SqliteFactor> for TomlRuntimeSource<'_> {
104
104
105
105
impl RuntimeConfigSourceFinalizer for TomlRuntimeSource < ' _ > {
106
106
fn finalize ( & mut self ) -> anyhow:: Result < ( ) > {
107
- Ok ( self . table . validate_all_keys_used ( ) . unwrap ( ) )
107
+ self . table . validate_all_keys_used ( ) ?;
108
+ Ok ( ( ) )
108
109
}
109
110
}
110
111
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ pub enum AzureKeyVaultAuthOptions {
90
90
///
91
91
/// Common across each:
92
92
/// - `AZURE_AUTHORITY_HOST`: (optional) the host for the identity provider. For example, for Azure public cloud the host defaults to "https://login.microsoftonline.com".
93
+ ///
93
94
/// See also: https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/identity/README.md
94
95
Environmental ,
95
96
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ async fn static_provider_works() -> anyhow::Result<()> {
31
31
} ) ) ?;
32
32
33
33
let mut state = env. build_instance_state ( ) . await ?;
34
- let val = state. variables . get ( "baz" . try_into ( ) . unwrap ( ) ) . await ?;
34
+ let val = state. variables . get ( "baz" . into ( ) ) . await ?;
35
35
assert_eq ! ( val, "<bar>" ) ;
36
36
Ok ( ( ) )
37
37
}
Original file line number Diff line number Diff line change @@ -187,11 +187,7 @@ impl FactorRuntimeConfigSource<OutboundMysqlFactor> for TomlRuntimeConfigSource<
187
187
188
188
impl FactorRuntimeConfigSource < LlmFactor > for TomlRuntimeConfigSource < ' _ > {
189
189
fn get_runtime_config ( & mut self ) -> anyhow:: Result < Option < spin_factor_llm:: RuntimeConfig > > {
190
- Ok ( llm:: runtime_config_from_toml (
191
- self . table . as_ref ( ) ,
192
- self . state_dir . clone ( ) ,
193
- self . use_gpu ,
194
- ) ?)
190
+ llm:: runtime_config_from_toml ( self . table . as_ref ( ) , self . state_dir . clone ( ) , self . use_gpu )
195
191
}
196
192
}
197
193
You can’t perform that action at this time.
0 commit comments