[s3metadata] extract to file
This commit is contained in:
parent
9d3c124b6e
commit
6eab5ada1e
3 changed files with 8 additions and 7 deletions
8
src/main/scala/net/kemitix/s3thorp/S3MetaData.scala
Normal file
8
src/main/scala/net/kemitix/s3thorp/S3MetaData.scala
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
package net.kemitix.s3thorp
|
||||||
|
|
||||||
|
import net.kemitix.s3thorp.Sync.{Hash, LastModified, LocalPath, RemotePath}
|
||||||
|
|
||||||
|
case class S3MetaData(localPath: LocalPath,
|
||||||
|
remotePath: RemotePath,
|
||||||
|
remoteHash: Hash,
|
||||||
|
remoteLastModified: LastModified)
|
|
@ -4,7 +4,6 @@ import java.nio.file.Path
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import fs2.Stream
|
import fs2.Stream
|
||||||
import cats.effect.IO
|
import cats.effect.IO
|
||||||
import net.kemitix.s3thorp.Sync.S3MetaData
|
|
||||||
import Main.putStrLn
|
import Main.putStrLn
|
||||||
|
|
||||||
trait S3MetaDataEnricher {
|
trait S3MetaDataEnricher {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import cats.effect._
|
||||||
import fs2.Stream
|
import fs2.Stream
|
||||||
import net.kemitix.s3thorp.Main.putStrLn
|
import net.kemitix.s3thorp.Main.putStrLn
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
|
||||||
import scala.concurrent.Promise
|
import scala.concurrent.Promise
|
||||||
|
|
||||||
object Sync extends LocalFileStream with S3MetaDataEnricher {
|
object Sync extends LocalFileStream with S3MetaDataEnricher {
|
||||||
|
@ -26,11 +25,6 @@ object Sync extends LocalFileStream with S3MetaDataEnricher {
|
||||||
type Hash = String // an MD5 hash
|
type Hash = String // an MD5 hash
|
||||||
type LastModified = Instant // or scala equivalent
|
type LastModified = Instant // or scala equivalent
|
||||||
|
|
||||||
case class S3MetaData(localPath: LocalPath,
|
|
||||||
remotePath: RemotePath,
|
|
||||||
remoteHash: Hash,
|
|
||||||
remoteLastModified: LastModified)
|
|
||||||
|
|
||||||
private def uploadRequiredFilter: S3MetaData => Stream[IO, Path] = s3Metadata => Stream.eval(for {
|
private def uploadRequiredFilter: S3MetaData => Stream[IO, Path] = s3Metadata => Stream.eval(for {
|
||||||
_ <- putStrLn(s"upload required: ${s3Metadata.localPath}")
|
_ <- putStrLn(s"upload required: ${s3Metadata.localPath}")
|
||||||
//md5File(localFile)
|
//md5File(localFile)
|
||||||
|
|
Loading…
Reference in a new issue