Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi committed Nov 7, 2024
1 parent 5a23171 commit 72a2153
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ jobs:

- name: Run network tests (with encrypt-records)
timeout-minutes: 25
run: cargo test --release --package sn_networking --features="open-metrics, encrypt-records"
run: cargo test --release --package sn_networking --features="open-metrics, encrypt-records" can_store_after_restart

- name: Run network tests (without encrypt-records)
timeout-minutes: 25
run: cargo test --release --package sn_networking --features="open-metrics"
run: cargo test --release --package sn_networking --features="open-metrics" can_store_after_restart

- name: Run protocol tests
timeout-minutes: 25
Expand Down
28 changes: 14 additions & 14 deletions sn_networking/src/record_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,18 @@ impl NodeRecordStore {
let process_entry = |entry: &DirEntry| -> _ {
let path = entry.path();
if path.is_file() {
debug!("Existing record found: {path:?}");
println!("Existing record found: {path:?}");
// if we've got a file, lets try and read it
let filename = match path.file_name().and_then(|n| n.to_str()) {
Some(file_name) => file_name,
None => {
// warn and remove this file as it's not a valid record
warn!(
println!(
"Found a file in the storage dir that is not a valid record: {:?}",
path
);
if let Err(e) = fs::remove_file(path) {
warn!(
println!(
"Failed to remove invalid record file from storage dir: {:?}",
e
);
Expand All @@ -258,9 +258,9 @@ impl NodeRecordStore {
} else {
// This will be due to node restart, result in different encrypt_detail.
// Hence need to clean up the old copy.
info!("Failed to decrypt record from file {filename:?}, clean it up.");
println!("Failed to decrypt record from file {filename:?}, clean it up.");
if let Err(e) = fs::remove_file(path) {
warn!(
println!(
"Failed to remove outdated record file {filename:?} from storage dir: {:?}",
e
);
Expand All @@ -269,7 +269,7 @@ impl NodeRecordStore {
}
}
Err(err) => {
error!("Error while reading file. filename: {filename}, error: {err:?}");
println!("Error while reading file. filename: {filename}, error: {err:?}");
return None;
}
};
Expand All @@ -281,14 +281,14 @@ impl NodeRecordStore {
RecordType::NonChunk(xorname_hash)
}
Err(error) => {
warn!(
println!(
"Failed to parse record type of record {filename:?}: {:?}",
error
);
// In correct decryption using different key could result in this.
// In that case, a cleanup shall be carried out.
if let Err(e) = fs::remove_file(path) {
warn!(
println!(
"Failed to remove invalid record file {filename:?} from storage dir: {:?}",
e
);
Expand All @@ -298,13 +298,13 @@ impl NodeRecordStore {
};

let address = NetworkAddress::from_record_key(&key);
info!("Existing record loaded: {path:?}");
println!("Existing record loaded: {path:?}");
return Some((key, (address, record_type)));
}
None
};

info!("Attempting to repopulate records from existing store...");
println!("Attempting to repopulate records from existing store...");
let records = WalkDir::new(&config.storage_dir)
.into_iter()
.filter_map(|e| e.ok())
Expand Down Expand Up @@ -354,7 +354,7 @@ impl NodeRecordStore {
network_event_sender: mpsc::Sender<NetworkEvent>,
swarm_cmd_sender: mpsc::Sender<LocalSwarmCmd>,
) -> Self {
info!("Using encryption_seed of {:?}", config.encryption_seed);
println!("Using encryption_seed of {:?}", config.encryption_seed);
let encryption_details = derive_aes256gcm_siv_from_seed(&config.encryption_seed);

// Recover the quoting_metrics first, as the historical file will be cleaned by
Expand Down Expand Up @@ -667,7 +667,7 @@ impl NodeRecordStore {
pub(crate) fn put_verified(&mut self, r: Record, record_type: RecordType) -> Result<()> {
let key = &r.key;
let record_key = PrettyPrintRecordKey::from(&r.key).into_owned();
debug!("PUTting a verified Record: {record_key:?}");
println!("PUTting a verified Record: {record_key:?}");

// if cache already has the record :
// * if with same content, do nothing and return early
Expand Down Expand Up @@ -706,12 +706,12 @@ impl NodeRecordStore {
let cmd = match fs::write(&file_path, bytes) {
Ok(_) => {
// vdash metric (if modified please notify at https://github.com/happybeing/vdash/issues):
info!("Wrote record {record_key2:?} to disk! filename: {filename}");
println!("Wrote record {record_key2:?} to disk! filename: {filename}");

LocalSwarmCmd::AddLocalRecordAsStored { key, record_type }
}
Err(err) => {
error!(
println!(
"Error writing record {record_key2:?} filename: {filename}, error: {err:?}"
);
LocalSwarmCmd::RemoveFailedLocalRecord { key }
Expand Down

0 comments on commit 72a2153

Please sign in to comment.