refactor: use std::io::Error::other() instead of Error::new(ErrorKind::Other, e)
This commit is contained in:
@@ -464,8 +464,8 @@ async fn background_writer(
|
|||||||
Ok(indices)
|
Ok(indices)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::new(
|
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::other(
|
||||||
std::io::ErrorKind::Other, e,
|
e,
|
||||||
))));
|
))));
|
||||||
dirty = result.is_ok();
|
dirty = result.is_ok();
|
||||||
let _ = reply.send(result);
|
let _ = reply.send(result);
|
||||||
@@ -498,8 +498,8 @@ async fn background_writer(
|
|||||||
m.flush_wal()
|
m.flush_wal()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::new(
|
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::other(
|
||||||
std::io::ErrorKind::Other, e,
|
e,
|
||||||
))));
|
))));
|
||||||
if result.is_ok() { dirty = false; }
|
if result.is_ok() { dirty = false; }
|
||||||
let _ = reply.send(result);
|
let _ = reply.send(result);
|
||||||
@@ -515,8 +515,8 @@ async fn background_writer(
|
|||||||
m.tick_session()
|
m.tick_session()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::new(
|
.unwrap_or_else(|e| Err(MemoryError::Io(std::io::Error::other(
|
||||||
std::io::ErrorKind::Other, e,
|
e,
|
||||||
))));
|
))));
|
||||||
if result.is_ok() { dirty = false; }
|
if result.is_ok() { dirty = false; }
|
||||||
let _ = reply.send(result);
|
let _ = reply.send(result);
|
||||||
@@ -549,7 +549,7 @@ async fn background_writer(
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
fn join_err(e: tokio::task::JoinError) -> MemoryError {
|
fn join_err(e: tokio::task::JoinError) -> MemoryError {
|
||||||
MemoryError::Io(std::io::Error::new(std::io::ErrorKind::Other, e))
|
MemoryError::Io(std::io::Error::other(e))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn channel_gone() -> MemoryError {
|
fn channel_gone() -> MemoryError {
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ impl GpuSearchBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have an accelerator but now above threshold, try init
|
// If we don't have an accelerator but now above threshold, try init
|
||||||
if vectors.len() >= self.threshold {
|
if vectors.len() >= self.threshold
|
||||||
if let Ok(mut accel) = clawhdf5_gpu::GpuAccelerator::new() {
|
&& let Ok(mut accel) = clawhdf5_gpu::GpuAccelerator::new() {
|
||||||
let flat: Vec<f32> = vectors.iter().flat_map(|v| v.iter().copied()).collect();
|
let flat: Vec<f32> = vectors.iter().flat_map(|v| v.iter().copied()).collect();
|
||||||
if accel.upload_vectors(&flat, self.dim).is_ok()
|
if accel.upload_vectors(&flat, self.dim).is_ok()
|
||||||
&& accel.upload_norms(norms).is_ok()
|
&& accel.upload_norms(norms).is_ok()
|
||||||
@@ -124,7 +124,6 @@ impl GpuSearchBackend {
|
|||||||
self.accelerator = Some(accel);
|
self.accelerator = Some(accel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "gpu"))]
|
#[cfg(not(feature = "gpu"))]
|
||||||
|
|||||||
Reference in New Issue
Block a user