cleanup: cleanup use clause (avoid *)
This commit is contained in:
parent
6252df4c18
commit
5bc8e80a99
@ -268,7 +268,7 @@ async move {
|
|||||||
}.boxed()
|
}.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const BACKUP_API_SUBDIRS: SubdirMap = &[
|
const BACKUP_API_SUBDIRS: SubdirMap = &[
|
||||||
(
|
(
|
||||||
"blob", &Router::new()
|
"blob", &Router::new()
|
||||||
.upload(&API_METHOD_UPLOAD_BLOB)
|
.upload(&API_METHOD_UPLOAD_BLOB)
|
||||||
|
@ -7,19 +7,61 @@ use hyper::http::request::Parts;
|
|||||||
use hyper::{Body, Response, Request, StatusCode};
|
use hyper::{Body, Response, Request, StatusCode};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use proxmox::{sortable, identity};
|
use proxmox::{
|
||||||
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
|
http_err,
|
||||||
use proxmox::api::schema::*;
|
sortable,
|
||||||
use proxmox::http_err;
|
identity,
|
||||||
|
list_subdirs_api_method,
|
||||||
|
api::{
|
||||||
|
ApiResponseFuture,
|
||||||
|
ApiHandler,
|
||||||
|
ApiMethod,
|
||||||
|
Router,
|
||||||
|
RpcEnvironment,
|
||||||
|
Permission,
|
||||||
|
router::SubdirMap,
|
||||||
|
schema::{
|
||||||
|
ObjectSchema,
|
||||||
|
BooleanSchema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::api2::types::*;
|
use crate::{
|
||||||
use crate::backup::*;
|
api2::{
|
||||||
use crate::server::{WorkerTask, H2Service};
|
helpers,
|
||||||
use crate::tools;
|
types::{
|
||||||
use crate::config::acl::{PRIV_DATASTORE_READ, PRIV_DATASTORE_BACKUP};
|
DATASTORE_SCHEMA,
|
||||||
use crate::config::cached_user_info::CachedUserInfo;
|
BACKUP_TYPE_SCHEMA,
|
||||||
use crate::api2::helpers;
|
BACKUP_TIME_SCHEMA,
|
||||||
use crate::tools::fs::lock_dir_noblock_shared;
|
BACKUP_ID_SCHEMA,
|
||||||
|
CHUNK_DIGEST_SCHEMA,
|
||||||
|
Authid,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
backup::{
|
||||||
|
DataStore,
|
||||||
|
ArchiveType,
|
||||||
|
BackupDir,
|
||||||
|
IndexFile,
|
||||||
|
archive_type,
|
||||||
|
},
|
||||||
|
server::{
|
||||||
|
WorkerTask,
|
||||||
|
H2Service,
|
||||||
|
},
|
||||||
|
tools::{
|
||||||
|
self,
|
||||||
|
fs::lock_dir_noblock_shared,
|
||||||
|
},
|
||||||
|
config::{
|
||||||
|
acl::{
|
||||||
|
PRIV_DATASTORE_READ,
|
||||||
|
PRIV_DATASTORE_BACKUP,
|
||||||
|
},
|
||||||
|
cached_user_info::CachedUserInfo,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
mod environment;
|
mod environment;
|
||||||
use environment::*;
|
use environment::*;
|
||||||
@ -171,21 +213,24 @@ fn upgrade_to_backup_reader_protocol(
|
|||||||
}.boxed()
|
}.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const READER_API_SUBDIRS: SubdirMap = &[
|
||||||
|
(
|
||||||
|
"chunk", &Router::new()
|
||||||
|
.download(&API_METHOD_DOWNLOAD_CHUNK)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"download", &Router::new()
|
||||||
|
.download(&API_METHOD_DOWNLOAD_FILE)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"speedtest", &Router::new()
|
||||||
|
.download(&API_METHOD_SPEEDTEST)
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
pub const READER_API_ROUTER: Router = Router::new()
|
pub const READER_API_ROUTER: Router = Router::new()
|
||||||
.subdirs(&[
|
.get(&list_subdirs_api_method!(READER_API_SUBDIRS))
|
||||||
(
|
.subdirs(READER_API_SUBDIRS);
|
||||||
"chunk", &Router::new()
|
|
||||||
.download(&API_METHOD_DOWNLOAD_CHUNK)
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"download", &Router::new()
|
|
||||||
.download(&API_METHOD_DOWNLOAD_FILE)
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"speedtest", &Router::new()
|
|
||||||
.download(&API_METHOD_SPEEDTEST)
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
||||||
@ -216,7 +261,7 @@ fn download_file(
|
|||||||
path.push(&file_name);
|
path.push(&file_name);
|
||||||
|
|
||||||
env.log(format!("download {:?}", path.clone()));
|
env.log(format!("download {:?}", path.clone()));
|
||||||
|
|
||||||
let index: Option<Box<dyn IndexFile + Send>> = match archive_type(&file_name)? {
|
let index: Option<Box<dyn IndexFile + Send>> = match archive_type(&file_name)? {
|
||||||
ArchiveType::FixedIndex => {
|
ArchiveType::FixedIndex => {
|
||||||
let index = env.datastore.open_fixed_reader(&path)?;
|
let index = env.datastore.open_fixed_reader(&path)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user