(ops: Options<'a>)
| 32 | impl VecStorage |
| 33 | { |
| 34 | pub async fn open<'a>(ops: Options<'a>) -> Result<Self, String> { |
| 35 | |
| 36 | match DiskLog::open(ops.path, ops.storage_name, ops.total_page_size) { |
| 37 | Err(e) => return Err(e.to_string()), |
| 38 | Ok(disklog) => { |
| 39 | // Run DiskLog |
| 40 | let off_disk = if let StorageType::RamCopies = ops.stype { true } else { false }; |
| 41 | |
| 42 | // Run Reporter |
| 43 | let reporter = Router::<Event<VectorId, Vector>>::new(vec![]).unwrap().run_service(); |
| 44 | |
| 45 | // Run disk_log |
| 46 | let wal_session = disklog.run_service(); |
| 47 | |
| 48 | |
| 49 | // Create VecStorage |
| 50 | let mut st = VecStorage { |
| 51 | vcache: DashMap::new(), |
| 52 | wal_session: wal_session, |
| 53 | reporter_session: reporter, |
| 54 | off_reporter: ops.off_reporter, |
| 55 | off_disk: true |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | // load from disk |
| 60 | if let Err(x) = st.loader().await { |
| 61 | if x != "End" { |
| 62 | return Err(x); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | |
| 67 | // because we want loader dont write to disk_log |
| 68 | st.off_disk = off_disk; |
| 69 | |
| 70 | return Ok(st); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | /// subscribe to Reporter |
| 77 | #[inline] |
nothing calls this directly
no test coverage detected