File tree Expand file tree Collapse file tree 5 files changed +28
-18
lines changed
Expand file tree Collapse file tree 5 files changed +28
-18
lines changed Original file line number Diff line number Diff line change 11# WIP 1.0.0
22
33 - added ` LeastMessageRouter `
4-
4+ - config now supports loading optional file ` ./config/tyra.toml ` to overwrite config parameters
5+ - defaults < ` ./config/tyra.toml ` < environment variables
56
67# 0.8.0
78
Original file line number Diff line number Diff line change @@ -18,17 +18,16 @@ name = "tyra"
1818path = " src/lib.rs"
1919
2020[dependencies ]
21- config = " 0.11.0 "
21+ config = " 0.13.2 "
2222hostname = " 0.3.1"
23- num_cpus = " 1.13.0 "
23+ num_cpus = " 1.13.1 "
2424threadpool = " 1.8.1"
25- crossbeam-channel = " ^0.5"
26- crossbeam-utils = " ^0.8"
27- dashmap = " ^4.0"
28- serde = { version = " ^1.0" , features = [" derive" ] }
29- thiserror = " 1.0.31"
30- log = " 0.4"
25+ crossbeam-channel = " 0.5.6"
3126flume = " 0.10.14"
27+ dashmap = " 5.4.0"
28+ serde = { version = " 1.0" , features = [" derive" ] }
29+ thiserror = " 1.0"
30+ log = " 0.4"
3231
3332[dev-dependencies ]
3433bincode = " 1.3.3"
Original file line number Diff line number Diff line change 22
33` Tyra ` is a cross-platform Typed Actor System Written in Rust.
44
5-
65## Current State
76
87` 0.8.0 ` is intended to be the last minor release before ` 1.0.0 ` where it's officially declared ready for production
@@ -18,6 +17,12 @@ So why's it not yet `1.0.0`?
1817
1918The current development status can be tracked in the [ CHANGELOG.md] ( CHANGELOG.md )
2019
20+ ## Configuration
21+
22+ See [ default.toml] ( ./src/config/default.toml ) for a list of all configuration parameters and their defaults.
23+
24+ Configuration can be adjusted by providing a ` ./config/tyra.toml ` .
25+
2126## Clustering
2227
2328Through the current implementation of the ` SerializedMessage ` it's proven that this system can be clustered.
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ impl Handler<MessageA> for Benchmark {
6969
7070fn main ( ) {
7171 let actor_config = TyraConfig :: new ( ) . unwrap ( ) ;
72+ let test = actor_config. thread_pool . config . get ( "default" ) . unwrap ( ) ;
73+ let test = test. threads_max ;
7274 let actor_system = ActorSystem :: new ( actor_config) ;
7375
7476 let message_count = 10000000 ;
@@ -84,6 +86,8 @@ fn main() {
8486 )
8587 . unwrap ( ) ;
8688 println ! ( "Actors have been created" ) ;
89+ println ! ( "TEST: {}" , actor. get_address( ) . system) ;
90+ println ! ( "TEST2: {}" , test) ;
8791 let start = Instant :: now ( ) ;
8892
8993 actor. sleep ( Duration :: from_secs ( 3 ) ) . unwrap ( ) ;
Original file line number Diff line number Diff line change 1+ use std:: path:: Path ;
12use crate :: config:: global_config:: GeneralConfig ;
23use crate :: config:: pool_config:: PoolConfig ;
34
@@ -33,19 +34,19 @@ impl TyraConfig {
3334 /// config.general.name = String::from("HelloWorld");
3435 /// ```
3536 pub fn new ( ) -> Result < Self , ConfigError > {
36- let mut config = Config :: new ( ) ;
3737
3838 let default: & str = std:: include_str!( "default.toml" ) ;
3939
40- config
41- . merge ( File :: from_str ( default, FileFormat :: Toml ) )
42- . expect ( "Could not load default Config" ) ;
40+ let mut config = Config :: builder ( ) ;
4341
44- config
45- . merge ( Environment :: with_prefix ( "TYRA" ) . separator ( "_CONFIG_" ) )
46- . expect ( "Could not parse ENV variables" ) ;
42+ config = config. add_source ( File :: from_str ( default, FileFormat :: Toml ) ) ;
43+ let path = Path :: new ( "config/tyra.toml" ) ;
44+ if path. exists ( ) {
45+ config = config. add_source ( File :: from ( Path :: new ( "config/tyra.toml" ) ) ) ;
46+ }
4747
48- let mut parsed: TyraConfig = config. try_into ( ) . expect ( "Could not parse Config" ) ;
48+ let conf = config. build ( ) . expect ( "Could not fetch Config" ) ;
49+ let mut parsed: TyraConfig = conf. try_deserialize ( ) . expect ( "Could not parse Config" ) ;
4950 if parsed. general . name == "$HOSTNAME" {
5051 parsed. general . name = String :: from ( hostname:: get ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ) ;
5152 }
You can’t perform that action at this time.
0 commit comments