package jnpf.fileStorage;
|
|
import io.minio.BucketExistsArgs;
|
import org.dromara.x.file.storage.core.platform.MinioFileStorage;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
public class SeaweedFsBucketVerifier {
|
|
public void verify(MinioFileStorage storage) {
|
String bucketName = storage.getBucketName();
|
try {
|
boolean exists = storage.getClient().bucketExists(BucketExistsArgs.builder()
|
.bucket(bucketName)
|
.build());
|
if (!exists) {
|
throw new IllegalStateException("SeaweedFS bucket 不存在: " + bucketName);
|
}
|
} catch (IllegalStateException exception) {
|
throw exception;
|
} catch (Exception exception) {
|
throw new IllegalStateException("SeaweedFS bucket 无法访问: " + bucketName, exception);
|
}
|
}
|
}
|