Created
February 22, 2021 14:51
-
-
Save conorgriffin/39b52000a350886ef556100bca5c4d10 to your computer and use it in GitHub Desktop.
FtpIOGraphStage - Multiple Read Requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected[this] def doPreStart(): Unit = | |
isOpt = ftpLike match { | |
case ur: UnconfirmedReads => | |
withUnconfirmedReads(ur) | |
case ro: RetrieveOffset => | |
Some(ro.retrieveFileInputStream(path, handler.get.asInstanceOf[ro.Handler], offset).get) | |
case _ => | |
Some(ftpLike.retrieveFileInputStream(path, handler.get).get) | |
} | |
private def withUnconfirmedReads( | |
ftpLikeWithUnconfirmedReads: FtpLike[FtpClient, S] with UnconfirmedReads | |
): Option[InputStream] = | |
connectionSettings match { | |
case s: SftpSettings => | |
Some( | |
ftpLikeWithUnconfirmedReads | |
.retrieveFileInputStream(path, | |
handler.get.asInstanceOf[ftpLikeWithUnconfirmedReads.Handler], | |
offset, | |
s.maxUnconfirmedReads) | |
.get | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment