-
Notifications
You must be signed in to change notification settings - Fork 3
Example with rusoto #39
Comments
Thanks for your interest in firetrap! It's not entirely clear to me what you're trying to do, but I'll try to help anyway. If you're interested in writing your own If you want to use the existing Does this help you achieve what you want? |
Thank you for reply!
We can't specify |
Hmm, to be honest I'm not sure what the best approach is then. The way the StorageBackend is used now, it really needs |
My example is here. fn get<P: AsRef<Path>>(
&self,
path: P,
) -> Box<Future<Item = Self::File, Error = Self::Error> + Send> {
let client = Arc::clone(&self.client);
let bucket = "xxxx";
let future = future::result(self.key(path))
.and_then(move |key| {
client
.get_object(rusoto_s3::GetObjectRequest {
bucket: bucket.into(),
key: key,
..Default::default()
})
.map_err(|_| ErrorKind::Unknown)
})
.and_then(|object| {
let body = object
.body
.unwrap_or_else(|| rusoto_core::ByteStream::from(vec![]));
tokio::codec::FramedRead::new(
body.into_async_read(),
tokio::codec::BytesCodec::new(),
)
.concat2()
.map_err(|_| ErrorKind::Unknown)
})
.map(|body| std::io::Cursor::new(body.to_vec()));
Box::new(future)
} I convert into But we will lost advantage async programing when we convert into |
I am in creating ftp server with rusto.
get_object()
function of rusto returns content body as ByteStream, so i want to return it as stream inget()
function.The function returns impl trait, but
StorageBackend
requires associate typeFile
, so I can't these types be mached.Can I get several examples or hints?
Thanks ;D
The text was updated successfully, but these errors were encountered: