Skip to content

Commit

Permalink
implemented flush method
Browse files Browse the repository at this point in the history
  • Loading branch information
bwsw committed Jun 4, 2024
1 parent 247629f commit 054c1af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Api for external language.
//! This file provides a trait to be used as an opaque pointer for C or Julia calls used in file libext.rs
use std::io::prelude::*;
use std::path::PathBuf;

use serde::{de::DeserializeOwned, Serialize};
Expand Down Expand Up @@ -81,15 +80,8 @@ where
//
let res = self.dump(DumpMode::Full, &mut dumpinit);
//
let outgraph = &mut dumpinit.graph_out;
let outdata = &mut dumpinit.data_out;
outgraph.flush().unwrap();
outdata.flush().unwrap();
//
drop(dumpinit.graph_out);
drop(dumpinit.data_out);
//
log::info!("\n end of dump");
dumpinit.flush()?;
log::info!("end of dump");
if res.is_ok() {
return Ok(dumpname);
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/hnswio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ impl DumpInit {
pub fn get_basename(&self) -> &String {
&self.basename
}

pub fn flush(&mut self) -> Result<()> {
self.data_out.flush()?;
self.graph_out.flush()?;
Ok(())
}
} // end impl for DumpInit

//====================================================
Expand Down

0 comments on commit 054c1af

Please sign in to comment.