mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
Merge pull request #296 from rustfs/dev_damon_ps1
fix: fix run error in windows os.
This commit is contained in:
@@ -51,6 +51,7 @@ use path_absolutize::Absolutize;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt::Debug;
|
||||
use std::io::SeekFrom;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
use std::sync::Arc;
|
||||
@@ -383,7 +384,10 @@ impl LocalDisk {
|
||||
kind => {
|
||||
if kind.to_string() != "directory not empty" {
|
||||
warn!("delete_file remove_dir {:?} err {}", &delete_path, kind.to_string());
|
||||
return Err(Error::from(err));
|
||||
return Err(Error::new(FileAccessDeniedWithContext {
|
||||
path: delete_path.clone(),
|
||||
source: err,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,7 +399,10 @@ impl LocalDisk {
|
||||
ErrorKind::NotFound => (),
|
||||
_ => {
|
||||
warn!("delete_file remove_file {:?} err {:?}", &delete_path, &err);
|
||||
return Err(Error::from(err));
|
||||
return Err(Error::new(FileAccessDeniedWithContext {
|
||||
path: delete_path.clone(),
|
||||
source: err,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -743,12 +750,10 @@ impl LocalDisk {
|
||||
.await
|
||||
.map_err(os_err_to_file_err)?;
|
||||
|
||||
// let mut data = Vec::new();
|
||||
// let n = file.read_to_end(&mut data).await?;
|
||||
|
||||
let meta = file.metadata().await?;
|
||||
let file_size = meta.len() as usize;
|
||||
|
||||
bitrot_verify(Box::new(file), meta.size() as usize, part_size, algo, sum.to_vec(), shard_size).await
|
||||
bitrot_verify(Box::new(file), file_size, part_size, algo, sum.to_vec(), shard_size).await
|
||||
}
|
||||
|
||||
async fn scan_dir<W: AsyncWrite + Unpin>(
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#![allow(unsafe_code)] // TODO: audit unsafe code
|
||||
|
||||
use super::IOStats;
|
||||
use crate::{disk::Info, error::Result};
|
||||
use crate::disk::Info;
|
||||
use common::error::Result;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::mem;
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
+19
-19
@@ -586,8 +586,8 @@ impl S3 for FS {
|
||||
.await
|
||||
.is_ok()
|
||||
|| authorize_request(&mut req, Action::S3Action(S3Action::GetBucketLocationAction))
|
||||
.await
|
||||
.is_ok()
|
||||
.await
|
||||
.is_ok()
|
||||
})
|
||||
});
|
||||
}
|
||||
@@ -1256,7 +1256,7 @@ impl S3 for FS {
|
||||
conditions: &conditions,
|
||||
object: "",
|
||||
})
|
||||
.await;
|
||||
.await;
|
||||
|
||||
let write_olny = PolicySys::is_allowed(&BucketPolicyArgs {
|
||||
bucket: &bucket,
|
||||
@@ -1267,7 +1267,7 @@ impl S3 for FS {
|
||||
conditions: &conditions,
|
||||
object: "",
|
||||
})
|
||||
.await;
|
||||
.await;
|
||||
|
||||
let is_public = read_olny && write_olny;
|
||||
|
||||
@@ -1680,11 +1680,11 @@ impl S3 for FS {
|
||||
// TODO: valid target list
|
||||
|
||||
if let Some(NotificationConfiguration {
|
||||
event_bridge_configuration,
|
||||
lambda_function_configurations,
|
||||
queue_configurations,
|
||||
topic_configurations,
|
||||
}) = has_notification_config
|
||||
event_bridge_configuration,
|
||||
lambda_function_configurations,
|
||||
queue_configurations,
|
||||
topic_configurations,
|
||||
}) = has_notification_config
|
||||
{
|
||||
Ok(S3Response::new(GetBucketNotificationConfigurationOutput {
|
||||
event_bridge_configuration,
|
||||
@@ -1785,10 +1785,10 @@ impl S3 for FS {
|
||||
//
|
||||
!gs.is_empty()
|
||||
&& gs.first().is_some_and(|g| {
|
||||
g.to_owned()
|
||||
.permission
|
||||
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
|
||||
})
|
||||
g.to_owned()
|
||||
.permission
|
||||
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1855,10 +1855,10 @@ impl S3 for FS {
|
||||
//
|
||||
!gs.is_empty()
|
||||
&& gs.first().is_some_and(|g| {
|
||||
g.to_owned()
|
||||
.permission
|
||||
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
|
||||
})
|
||||
g.to_owned()
|
||||
.permission
|
||||
.is_some_and(|p| p.as_str() == Permission::FULL_CONTROL)
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1934,9 +1934,9 @@ impl S3 for FS {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn bytes_stream<S, E>(stream: S, content_length: usize) -> impl Stream<Item=Result<Bytes, E>> + Send + 'static
|
||||
pub fn bytes_stream<S, E>(stream: S, content_length: usize) -> impl Stream<Item = Result<Bytes, E>> + Send + 'static
|
||||
where
|
||||
S: Stream<Item=Result<Bytes, E>> + Send + 'static,
|
||||
S: Stream<Item = Result<Bytes, E>> + Send + 'static,
|
||||
E: Send + 'static,
|
||||
{
|
||||
AsyncTryStream::<Bytes, E, _>::new(|mut y| async move {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
console static path, do not delete
|
||||
@@ -1,34 +0,0 @@
|
||||
@echo off
|
||||
rem filepath: run.bat
|
||||
|
||||
if not defined SKIP_BUILD (
|
||||
cargo build -p rustfs --bins
|
||||
)
|
||||
|
||||
set current_dir=%cd%
|
||||
|
||||
if not exist .\target\volume\test mkdir .\target\volume\test
|
||||
|
||||
if not defined RUST_LOG (
|
||||
set RUST_BACKTRACE=1
|
||||
set RUST_LOG=rustfs=debug,ecstore=debug,s3s=debug,iam=debug
|
||||
)
|
||||
|
||||
rem set RUSTFS_ERASURE_SET_DRIVE_COUNT=5
|
||||
|
||||
rem set RUSTFS_STORAGE_CLASS_INLINE_BLOCK=512 KB
|
||||
|
||||
rem set RUSTFS_VOLUMES=.\target\volume\test{0...4}
|
||||
set RUSTFS_VOLUMES=.\target\volume\test
|
||||
set RUSTFS_ADDRESS=0.0.0.0:9000
|
||||
set RUSTFS_CONSOLE_ENABLE=true
|
||||
set RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9002
|
||||
rem set RUSTFS_SERVER_DOMAINS=localhost:9000
|
||||
rem 具体路径修改为配置文件真实路径,obs.example.toml 仅供参考
|
||||
set RUSTFS_OBS_CONFIG=.\config\obs.example.toml"
|
||||
|
||||
if not "%~1"=="" (
|
||||
set RUSTFS_VOLUMES=%~1
|
||||
)
|
||||
|
||||
cargo run --bin rustfs
|
||||
@@ -0,0 +1,51 @@
|
||||
# Check if static files need to be downloaded
|
||||
if (-not (Test-Path .\rustfs\static\index.html)) {
|
||||
Write-Host "Downloading rustfs-console-latest.zip"
|
||||
|
||||
Invoke-WebRequest -Uri "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" -OutFile 'tempfile.zip'
|
||||
Expand-Archive -Path 'tempfile.zip' -DestinationPath '.\rustfs\static' -Force
|
||||
Remove-Item tempfile.zip
|
||||
}
|
||||
|
||||
# Check if build should be skipped
|
||||
if (-not $env:SKIP_BUILD) {
|
||||
cargo build -p rustfs --bins
|
||||
}
|
||||
|
||||
$current_dir = Get-Location
|
||||
|
||||
# Create multiple test directories
|
||||
$testDirs = @("test0", "test1", "test2", "test3", "test4")
|
||||
foreach ($dir in $testDirs) {
|
||||
$path = Join-Path -Path ".\target\volume" -ChildPath $dir
|
||||
if (-not (Test-Path $path)) {
|
||||
New-Item -ItemType Directory -Path $path -Force | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
# Set environment variables
|
||||
if (-not $env:RUST_LOG) {
|
||||
$env:RUST_BACKTRACE = 1
|
||||
$env:RUST_LOG = "rustfs=debug,ecstore=debug,s3s=debug,iam=debug"
|
||||
}
|
||||
|
||||
# The following environment variables are commented out, uncomment them if needed
|
||||
# $env:RUSTFS_ERASURE_SET_DRIVE_COUNT = 5
|
||||
# $env:RUSTFS_STORAGE_CLASS_INLINE_BLOCK = "512 KB"
|
||||
|
||||
$env:RUSTFS_VOLUMES = ".\target\volume\test{0...4}"
|
||||
# $env:RUSTFS_VOLUMES = ".\target\volume\test"
|
||||
$env:RUSTFS_ADDRESS = "127.0.0.1:9000"
|
||||
$env:RUSTFS_CONSOLE_ENABLE = "true"
|
||||
$env:RUSTFS_CONSOLE_ADDRESS = "127.0.0.1:9002"
|
||||
# $env:RUSTFS_SERVER_DOMAINS = "localhost:9000"
|
||||
# Change to the actual configuration file path, obs.example.toml is for reference only
|
||||
$env:RUSTFS_OBS_CONFIG = ".\config\obs.example.toml"
|
||||
|
||||
# Check command line arguments
|
||||
if ($args.Count -gt 0) {
|
||||
$env:RUSTFS_VOLUMES = $args[0]
|
||||
}
|
||||
|
||||
# Run the program
|
||||
cargo run --bin rustfs
|
||||
+1
-1
@@ -39,7 +39,7 @@ fi
|
||||
if [ ! -f ./rustfs/static/index.html ]; then
|
||||
echo "Downloading rustfs-console-latest.zip"
|
||||
# download rustfs-console-latest.zip do not show log
|
||||
curl -s -L "https://dl.rustfs.com/console/rustfs-console-latest.zip" -o tempfile.zip && unzip -q -o tempfile.zip -d ./rustfs/static && rm tempfile.zip
|
||||
curl -s -L "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" -o tempfile.zip && unzip -q -o tempfile.zip -d ./rustfs/static && rm tempfile.zip
|
||||
fi
|
||||
|
||||
cargo run --bin rustfs
|
||||
Reference in New Issue
Block a user