async index reader: typedef ReadFuture

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2021-01-25 14:42:50 +01:00 committed by Wolfgang Bumiller
parent 12e874cef0
commit bd215dc0e4

View File

@ -15,6 +15,8 @@ use super::IndexFile;
use super::read_chunk::AsyncReadChunk; use super::read_chunk::AsyncReadChunk;
use super::index::ChunkReadInfo; use super::index::ChunkReadInfo;
type ReadFuture<S> = dyn Future<Output = Result<(S, Vec<u8>), Error>> + Send + 'static;
// FIXME: This enum may not be required? // FIXME: This enum may not be required?
// - Put the `WaitForData` case directly into a `read_future: Option<>` // - Put the `WaitForData` case directly into a `read_future: Option<>`
// - make the read loop as follows: // - make the read loop as follows:
@ -28,7 +30,7 @@ use super::index::ChunkReadInfo;
#[allow(clippy::enum_variant_names)] #[allow(clippy::enum_variant_names)]
enum AsyncIndexReaderState<S> { enum AsyncIndexReaderState<S> {
NoData, NoData,
WaitForData(Pin<Box<dyn Future<Output = Result<(S, Vec<u8>), Error>> + Send + 'static>>), WaitForData(Pin<Box<ReadFuture<S>>>),
HaveData, HaveData,
} }