Skip to content

Commit

Permalink
watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
John-LittleBearLabs committed Aug 9, 2023
1 parent f5346e6 commit 767a2dc
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 103 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
project: [ myceli, controller, hyphae ]
project: [ myceli, controller, hyphae, watcher ]
target:
[
armv7-unknown-linux-gnueabihf,
Expand Down Expand Up @@ -60,6 +60,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
project: [ myceli, watcher ]
target:
[
armv7-unknown-linux-gnueabihf,
Expand All @@ -73,14 +74,14 @@ jobs:
- name: clean cargo
run: cargo clean
- name: cargo/cross build
run: CROSS_CONFIG=Cross.toml cross build --bin myceli --target ${{ matrix.target }} --profile small --features small --no-default-features
run: CROSS_CONFIG=Cross.toml cross build --bin ${{ matrix.project }} --target ${{ matrix.target }} --profile small --features small --no-default-features
- name: Compress binary
run: |
tar -cvf myceli-small-${{ github.ref_name }}-${{ matrix.target }}.tar -C ./target/${{ matrix.target }}/small myceli
xz -9 --keep --extreme myceli-small-${{ github.ref_name }}-${{ matrix.target }}.tar
gzip --best myceli-small-${{ github.ref_name }}-${{ matrix.target }}.tar
tar -cvf ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar -C ./target/${{ matrix.target }}/small ${{ matrix.project }}
xz -9 --keep --extreme ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar
gzip --best ${{ matrix.project }}-small-${{ github.ref_name }}-${{ matrix.target }}.tar
- name: upload binary
run: gh release upload "$GITHUB_REF" myceli-small-${{ github.ref_name }}-${{ matrix.target }}.tar.?z
run: gh release upload "$GITHUB_REF" *-small-${{ github.ref_name }}-${{ matrix.target }}.tar.?z
env:
GITHUB_TOKEN: ${{ github.token }}
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .idea/space.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 43 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ edition = "2021"
anyhow.workspace = true
dirs = "5.0.1"
figment.workspace = true
log.workspace = true
serde.workspace = true
transports.workspace = true
3 changes: 2 additions & 1 deletion config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use figment::{
providers::{Format, Serialized, Toml},
Figment, Provider,
};
use log::debug;
use serde::{Deserialize, Serialize};
use transports::MAX_MTU;

Expand Down Expand Up @@ -69,7 +70,7 @@ impl Config {
let mut config = Figment::from(Serialized::defaults(Config::default()));
if let Some(path) = path.or(default_path()) {
let toml_values = Toml::file(&path);
println!("Config values in file {}: {:?}", &path, toml_values.data());
debug!("Config values in file {}: {:?}", &path, toml_values.data());
config = config.merge(toml_values);
}
let config: Self = config.extract()?;
Expand Down
3 changes: 2 additions & 1 deletion local-storage/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::fs::File as FsFile;
use std::io::Write;
use std::path::Path;

use log::{error, info};
use log::{debug, error, info};

pub struct Storage {
pub provider: Box<dyn StorageProvider>,
Expand All @@ -28,6 +28,7 @@ impl Storage {
}

pub fn import_path(&self, path: &Path) -> Result<String> {
debug!("import_path({:?})", &path);
let rt = tokio::runtime::Runtime::new()?;
let blocks: Result<Vec<Block>> = rt.block_on(async {
let file: File = FileBuilder::new()
Expand Down
1 change: 1 addition & 0 deletions myceli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rust-version.workspace = true
[dependencies]
anyhow.workspace = true
cid = { workspace = true, features = ["scale-codec"] }
config.workspace = true
env_logger = { workspace = true, optional = true }
figment.workspace = true
local-storage = { path = "../local-storage", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions myceli/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
use std::thread::spawn;
use transports::Transport;

use log::{debug, error, info};
use log::{error, info};

pub struct Listener<T> {
storage_path: String,
Expand Down Expand Up @@ -100,7 +100,7 @@ impl<T: Transport + Send + 'static> Listener<T> {
}
}
Err(_e) => {
debug!("Receive message failed: {_e}");
println!("Receive message failed: {_e}");
}
}
}
Expand All @@ -112,7 +112,7 @@ impl<T: Transport + Send + 'static> Listener<T> {
sender_addr: &str,
shipper_sender: Sender<(DataProtocol, String)>,
) -> Result<Option<Message>> {
info!("Handling {message:?}");
println!("Handling {message:?}");
let resp = match message {
Message::ApplicationAPI(ApplicationAPI::TransmitDag {
cid,
Expand Down
8 changes: 5 additions & 3 deletions watcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow.workspace = true
config.workspace = true
env_logger = { workspace = true, optional = true }
log.workspace = true
messages.workspace = true
notify = "6.0.1"
smalog = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }
tracing-subscriber = { workspace = true, optional = true }
transports.workspace = true

[features]
big = ["good_log"]
small = ["small_log"]
good_log = ["dep:tracing", "dep:tracing-subscriber"]
good_log = ["dep:env_logger"]
small_log = ["dep:smalog"]
Loading

0 comments on commit 767a2dc

Please sign in to comment.