Browse Source

clean up all compiler warnings (22 warnings → 0)

Remove unused imports, prefix unused variables, add #[allow(dead_code)]
for fields/methods used only in specific contexts (serde deserialization,
non-unix builds, future error tracking).
rust-volume-server
Chris Lu 3 days ago
parent
commit
822762c093
  1. 5
      seaweed-volume/src/server/grpc_server.rs
  2. 3
      seaweed-volume/src/server/handlers.rs
  3. 2
      seaweed-volume/src/server/volume_server.rs
  4. 1
      seaweed-volume/src/storage/disk_location.rs
  5. 2
      seaweed-volume/src/storage/erasure_coding/ec_decoder.rs
  6. 4
      seaweed-volume/src/storage/erasure_coding/ec_encoder.rs
  7. 2
      seaweed-volume/src/storage/erasure_coding/ec_locate.rs
  8. 3
      seaweed-volume/src/storage/erasure_coding/ec_shard.rs
  9. 4
      seaweed-volume/src/storage/erasure_coding/ec_volume.rs
  10. 9
      seaweed-volume/src/storage/volume.rs

5
seaweed-volume/src/server/grpc_server.rs

@ -856,7 +856,7 @@ impl VolumeServer for VolumeGrpcService {
let mut stream = request.into_inner();
let mut target_file: Option<std::fs::File> = None;
let mut file_path = String::new();
let mut file_path;
let mut bytes_written: u64 = 0;
while let Some(req) = stream.message().await? {
@ -1308,7 +1308,7 @@ impl VolumeServer for VolumeGrpcService {
let vid = VolumeId(req.volume_id);
// Validate disk_id
let (loc_count, dest_dir) = {
let (_loc_count, dest_dir) = {
let store = self.state.store.read().unwrap();
let count = store.locations.len();
let dir = if (req.disk_id as usize) < count {
@ -2055,7 +2055,6 @@ impl VolumeServer for VolumeGrpcService {
// Read the needle header from EC shards to get cookie
// The needle is at the actual offset in the reconstructed data
let actual_offset = offset.to_actual_offset();
use crate::storage::erasure_coding::ec_shard::ERASURE_CODING_SMALL_BLOCK_SIZE;
let shard_size = ec_vol.shards.iter()
.filter_map(|s| s.as_ref())
.map(|s| s.file_size())

3
seaweed-volume/src/server/handlers.rs

@ -14,7 +14,6 @@ use axum::response::{IntoResponse, Response};
use serde::{Deserialize, Serialize};
use crate::metrics;
use crate::security::Guard;
use crate::storage::needle::needle::Needle;
use crate::storage::types::*;
use super::volume_server::VolumeServerState;
@ -1048,6 +1047,7 @@ pub async fn ui_handler(
// ============================================================================
#[derive(Deserialize)]
#[allow(dead_code)]
struct ChunkManifest {
#[serde(default)]
name: String,
@ -1063,6 +1063,7 @@ struct ChunkManifest {
struct ChunkInfo {
fid: String,
offset: i64,
#[allow(dead_code)]
size: i64,
}

2
seaweed-volume/src/server/volume_server.rs

@ -152,7 +152,7 @@ pub fn build_admin_router(state: Arc<VolumeServerState>) -> Router {
.route("/favicon.ico", get(handlers::favicon_handler))
.route("/seaweedfsstatic/*path", get(handlers::static_asset_handler))
.route("/ui/index.html", get(handlers::ui_handler))
.route("/", any(|state: State<Arc<VolumeServerState>>, request: Request| async move {
.route("/", any(|_state: State<Arc<VolumeServerState>>, request: Request| async move {
match request.method().clone() {
Method::OPTIONS => admin_options_response(),
Method::GET => StatusCode::OK.into_response(),

1
seaweed-volume/src/storage/disk_location.rs

@ -7,7 +7,6 @@
use std::collections::HashMap;
use std::fs;
use std::io;
use std::path::Path;
use std::sync::atomic::{AtomicI32, AtomicU64, Ordering};
use crate::storage::needle_map::NeedleMapKind;

2
seaweed-volume/src/storage/erasure_coding/ec_decoder.rs

@ -4,7 +4,7 @@
//! and the sorted index (.ecx) + deletion journal (.ecj).
use std::fs::File;
use std::io::{self, Read, Write};
use std::io::{self, Write};
use crate::storage::erasure_coding::ec_shard::*;
use crate::storage::idx;

4
seaweed-volume/src/storage/erasure_coding/ec_encoder.rs

@ -4,7 +4,9 @@
//! (1GB large, 1MB small) and encoded across 14 shard files.
use std::fs::File;
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::io;
#[cfg(not(unix))]
use std::io::{Seek, SeekFrom};
use reed_solomon_erasure::galois_8::ReedSolomon;

2
seaweed-volume/src/storage/erasure_coding/ec_locate.rs

@ -107,7 +107,7 @@ fn add_intervals(
offset: i64,
size: i64,
block_size: i64,
row_size: i64,
_row_size: i64,
is_large_block: bool,
large_block_rows_count: usize,
) {

3
seaweed-volume/src/storage/erasure_coding/ec_shard.rs

@ -1,8 +1,7 @@
//! EcVolumeShard: a single shard file (.ec00-.ec13) of an erasure-coded volume.
use std::fs::{self, File, OpenOptions};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::path::Path;
use std::io::{self, Write};
use crate::storage::types::*;

4
seaweed-volume/src/storage/erasure_coding/ec_volume.rs

@ -3,9 +3,8 @@
//! Each EcVolume has a sorted index (.ecx) and a deletion journal (.ecj).
//! Shards (.ec00-.ec13) may be distributed across multiple servers.
use std::collections::HashMap;
use std::fs::{self, File, OpenOptions};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::io::{self, Write};
use crate::storage::erasure_coding::ec_locate;
use crate::storage::erasure_coding::ec_shard::*;
@ -76,6 +75,7 @@ impl EcVolume {
// ---- File names ----
#[allow(dead_code)]
fn base_name(&self) -> String {
crate::storage::volume::volume_file_name(&self.dir, &self.collection, self.volume_id)
}

9
seaweed-volume/src/storage/volume.rs

@ -94,7 +94,7 @@ pub struct Volume {
is_compacting: bool,
last_io_error: Option<io::Error>,
_last_io_error: Option<io::Error>,
}
/// Windows helper: loop seek_read until buffer is fully filled.
@ -146,7 +146,7 @@ impl Volume {
last_compact_index_offset: 0,
last_compact_revision: 0,
is_compacting: false,
last_io_error: None,
_last_io_error: None,
};
v.load(true, true, preallocate, version)?;
@ -600,7 +600,7 @@ impl Volume {
}
fn do_delete_request(&mut self, n: &mut Needle) -> Result<Size, VolumeError> {
let (found, size, stored_offset) = if let Some(nm) = &self.nm {
let (found, size, _stored_offset) = if let Some(nm) = &self.nm {
if let Some(nv) = nm.get(n.id) {
if !nv.size.is_deleted() {
(true, nv.size, nv.offset)
@ -1041,10 +1041,11 @@ impl Volume {
Ok(())
}
#[allow(dead_code)]
fn check_read_write_error(&mut self, err: &io::Error) {
if err.raw_os_error() == Some(5) {
// EIO
self.last_io_error = Some(io::Error::new(err.kind(), err.to_string()));
self._last_io_error = Some(io::Error::new(err.kind(), err.to_string()));
}
}
}

Loading…
Cancel
Save