GP
Size: a a a
AM
λ
GP
λ
λ
VS
VS
λ
λ
λ
λ
λ
EB
NV
R
def uploadToS3_example(req: Request[IO], attributes: Attributes) = {
val bucketName = "bucketName"
val key = "key"
val contentType = ContentType.parse("image/jpeg").right.get
val metaData = MetaHeaders(Map("Content-Type" -> "image/jpeg", "Cache-Control" -> "max-age = 3600"))
val accessControlList = CannedAcl.PublicRead
req.body
.through(toInputStream)
.evalMap(inputStream => IO(
StreamConverters
.fromInputStream(() => inputStream)
.runWith(
S3.multipartUpload(bucketName, key, contentType, metaData, accessControlList)
.withAttributes(attributes)
)
))
.compile
.drain
}
R
VS
def anotherWork(): Future[Unit] = { .... }
def doSomething(): Future[String] = {
// Хочу запустить anotherWork в фоне, чтобы doSomething не ожидал его завершения
Future.successful("Main work is complete")
}
ActorSystem
есть.ЮБ
def anotherWork(): Future[Unit] = { .... }
def doSomething(): Future[String] = {
// Хочу запустить anotherWork в фоне, чтобы doSomething не ожидал его завершения
Future.successful("Main work is complete")
}
ActorSystem
есть.VS