mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 13:16:28 +00:00
todo
This commit is contained in:
@@ -169,3 +169,10 @@ impl From<rmp::decode::MarkerReadError> for Error {
|
||||
Error::RmpDecodeMarkerRead(serr)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_io_eof(e: &Error) -> bool {
|
||||
match e {
|
||||
Error::Io(e) => e.kind() == std::io::ErrorKind::UnexpectedEof,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,11 +515,7 @@ impl FileMeta {
|
||||
let has_vid = {
|
||||
if !version_id.is_empty() {
|
||||
let id = Uuid::parse_str(version_id)?;
|
||||
if !id.is_nil() {
|
||||
Some(id)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if !id.is_nil() { Some(id) } else { None }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@@ -571,6 +567,16 @@ impl FileMeta {
|
||||
versions.push(fi);
|
||||
}
|
||||
|
||||
let mut prev_mod_time = None;
|
||||
for (i, fi) in versions.iter_mut().enumerate() {
|
||||
if i == 0 {
|
||||
fi.is_latest = true;
|
||||
} else {
|
||||
fi.successor_mod_time = prev_mod_time;
|
||||
}
|
||||
prev_mod_time = fi.mod_time;
|
||||
}
|
||||
|
||||
Ok(FileInfoVersions {
|
||||
volume: volume.to_string(),
|
||||
name: path.to_string(),
|
||||
@@ -1225,11 +1231,7 @@ impl FileMetaVersionHeader {
|
||||
cur.read_exact(&mut buf)?;
|
||||
self.version_id = {
|
||||
let id = Uuid::from_bytes(buf);
|
||||
if id.is_nil() {
|
||||
None
|
||||
} else {
|
||||
Some(id)
|
||||
}
|
||||
if id.is_nil() { None } else { Some(id) }
|
||||
};
|
||||
|
||||
// mod_time
|
||||
@@ -1403,11 +1405,7 @@ impl MetaObject {
|
||||
cur.read_exact(&mut buf)?;
|
||||
self.version_id = {
|
||||
let id = Uuid::from_bytes(buf);
|
||||
if id.is_nil() {
|
||||
None
|
||||
} else {
|
||||
Some(id)
|
||||
}
|
||||
if id.is_nil() { None } else { Some(id) }
|
||||
};
|
||||
}
|
||||
"DDir" => {
|
||||
@@ -1416,11 +1414,7 @@ impl MetaObject {
|
||||
cur.read_exact(&mut buf)?;
|
||||
self.data_dir = {
|
||||
let id = Uuid::from_bytes(buf);
|
||||
if id.is_nil() {
|
||||
None
|
||||
} else {
|
||||
Some(id)
|
||||
}
|
||||
if id.is_nil() { None } else { Some(id) }
|
||||
};
|
||||
}
|
||||
"EcAlgo" => {
|
||||
@@ -1986,11 +1980,7 @@ impl MetaDeleteMarker {
|
||||
cur.read_exact(&mut buf)?;
|
||||
self.version_id = {
|
||||
let id = Uuid::from_bytes(buf);
|
||||
if id.is_nil() {
|
||||
None
|
||||
} else {
|
||||
Some(id)
|
||||
}
|
||||
if id.is_nil() { None } else { Some(id) }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ impl Stream for ReceiverStream {
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
let poll = Pin::new(&mut self.receiver).poll_recv(cx);
|
||||
match &poll {
|
||||
Poll::Ready(Some(Some(ref bytes))) => {
|
||||
Poll::Ready(Some(Some(bytes))) => {
|
||||
http_log!("[ReceiverStream] poll_next: got {} bytes", bytes.len());
|
||||
}
|
||||
Poll::Ready(Some(None)) => {
|
||||
|
||||
Reference in New Issue
Block a user