Skip to content

Commit c6ed3a1

Browse files
committed
update dependencies
1 parent 5de1a48 commit c6ed3a1

File tree

5 files changed

+28
-18
lines changed

5 files changed

+28
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
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

Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ name = "tyra"
1818
path = "src/lib.rs"
1919

2020
[dependencies]
21-
config = "0.11.0"
21+
config = "0.13.2"
2222
hostname = "0.3.1"
23-
num_cpus = "1.13.0"
23+
num_cpus = "1.13.1"
2424
threadpool = "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"
3126
flume = "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]
3433
bincode = "1.3.3"

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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

1918
The 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

2328
Through the current implementation of the `SerializedMessage` it's proven that this system can be clustered.

examples/benchmark_single_actor_process_after_send.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ impl Handler<MessageA> for Benchmark {
6969

7070
fn 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();

src/config/tyra_config.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::path::Path;
12
use crate::config::global_config::GeneralConfig;
23
use 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
}

0 commit comments

Comments
 (0)