feat: add with_capacity for content (#671)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
9ecc4d2659
commit
94952ae77c
16
Cargo.toml
16
Cargo.toml
|
|
@ -12,7 +12,7 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.100"
|
version = "0.1.101"
|
||||||
authors = ["The Dragonfly Developers"]
|
authors = ["The Dragonfly Developers"]
|
||||||
homepage = "https://d7y.io/"
|
homepage = "https://d7y.io/"
|
||||||
repository = "https://github.com/dragonflyoss/client.git"
|
repository = "https://github.com/dragonflyoss/client.git"
|
||||||
|
|
@ -22,13 +22,13 @@ readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
dragonfly-client = { path = "dragonfly-client", version = "0.1.100" }
|
dragonfly-client = { path = "dragonfly-client", version = "0.1.101" }
|
||||||
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.100" }
|
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.101" }
|
||||||
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.100" }
|
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.101" }
|
||||||
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.100" }
|
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.101" }
|
||||||
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.100" }
|
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.101" }
|
||||||
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.100" }
|
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.101" }
|
||||||
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.100" }
|
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.101" }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
dragonfly-api = "2.0.148"
|
dragonfly-api = "2.0.148"
|
||||||
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }
|
reqwest = { version = "0.12.4", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }
|
||||||
|
|
|
||||||
|
|
@ -791,7 +791,7 @@ impl DfdaemonUpload for DfdaemonUploadServerHandler {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Read the content of the piece.
|
// Read the content of the piece.
|
||||||
let mut content = Vec::new();
|
let mut content = Vec::with_capacity(piece.length as usize);
|
||||||
reader.read_to_end(&mut content).await.map_err(|err| {
|
reader.read_to_end(&mut content).await.map_err(|err| {
|
||||||
// Collect upload piece failure metrics.
|
// Collect upload piece failure metrics.
|
||||||
collect_upload_piece_failure_metrics();
|
collect_upload_piece_failure_metrics();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue