reduce compiler warnings
This commit is contained in:
parent
e8edbbd49c
commit
2085142ed4
|
@ -2,11 +2,11 @@ use failure::*;
|
||||||
|
|
||||||
use crate::api::schema::*;
|
use crate::api::schema::*;
|
||||||
use crate::api::router::*;
|
use crate::api::router::*;
|
||||||
use crate::server::rest::*;
|
//use crate::server::rest::*;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
|
|
||||||
use hyper::StatusCode;
|
//use hyper::StatusCode;
|
||||||
use hyper::rt::{Future, Stream};
|
//use hyper::rt::{Future, Stream};
|
||||||
|
|
||||||
use crate::config::datastore;
|
use crate::config::datastore;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ use failure::*;
|
||||||
|
|
||||||
use crate::backup::datastore::*;
|
use crate::backup::datastore::*;
|
||||||
use crate::backup::archive_index::*;
|
use crate::backup::archive_index::*;
|
||||||
use crate::server::rest::*;
|
//use crate::server::rest::*;
|
||||||
use crate::api::schema::*;
|
use crate::api::schema::*;
|
||||||
use crate::api::router::*;
|
use crate::api::router::*;
|
||||||
|
|
||||||
use serde_json::{json, Value};
|
use serde_json::Value;
|
||||||
|
use std::io::Write;
|
||||||
use std::sync::Arc;
|
|
||||||
use futures::*;
|
use futures::*;
|
||||||
|
|
||||||
pub struct UploadCaTar {
|
pub struct UploadCaTar {
|
||||||
|
@ -23,20 +22,16 @@ impl Future for UploadCaTar {
|
||||||
|
|
||||||
fn poll(&mut self) -> Poll<(), failure::Error> {
|
fn poll(&mut self) -> Poll<(), failure::Error> {
|
||||||
loop {
|
loop {
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
match try_ready!(self.stream.poll()) {
|
match try_ready!(self.stream.poll()) {
|
||||||
Some(chunk) => {
|
Some(chunk) => {
|
||||||
self.count += chunk.len();
|
self.count += chunk.len();
|
||||||
println!("UPLOAD Chunk {} {}", chunk.len(), self.count);
|
|
||||||
if let Err(err) = self.index.write(&chunk) {
|
if let Err(err) = self.index.write(&chunk) {
|
||||||
bail!("writing chunk failed - {}", err);
|
bail!("writing chunk failed - {}", err);
|
||||||
}
|
}
|
||||||
return Ok(Async::NotReady);
|
return Ok(Async::NotReady);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
println!("UPLOAD Close Index {}", self.count);
|
self.index.close()?;
|
||||||
self.index.close();
|
|
||||||
return Ok(Async::Ready(()))
|
return Ok(Async::Ready(()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,18 +43,16 @@ fn upload_catar(req_body: hyper::Body, param: Value, _info: &ApiUploadMethod) ->
|
||||||
|
|
||||||
let store = param["name"].as_str().unwrap();
|
let store = param["name"].as_str().unwrap();
|
||||||
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
println!("Upload .catar to {}", store);
|
println!("Upload .catar to {}", store);
|
||||||
|
|
||||||
let chunk_size = 4*1024*1024;
|
let chunk_size = 4*1024*1024;
|
||||||
let datastore = DataStore::lookup_datastore(store).unwrap().clone();
|
let datastore = DataStore::lookup_datastore(store).unwrap().clone();
|
||||||
|
|
||||||
let mut index = datastore.create_archive_writer("upload.aidx", chunk_size).unwrap();
|
let index = datastore.create_archive_writer("upload.aidx", chunk_size).unwrap();
|
||||||
|
|
||||||
let upload = UploadCaTar { stream: req_body, index, count: 0};
|
let upload = UploadCaTar { stream: req_body, index, count: 0};
|
||||||
|
|
||||||
let resp = upload.and_then(|v| {
|
let resp = upload.and_then(|_| {
|
||||||
|
|
||||||
let response = http::Response::builder()
|
let response = http::Response::builder()
|
||||||
.status(200)
|
.status(200)
|
||||||
|
|
Loading…
Reference in New Issue