Skip to content

Commit

Permalink
Fix compilation errors due to meta-core upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzov committed Sep 11, 2024
1 parent 10f6787 commit 0992c55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 13 additions & 8 deletions src/main/scala/se/lu/nateko/cp/data/routes/DownloadRouting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,21 @@ class DownloadRouting(
}
}

private def collectCollObjectHashes(collHash: Sha256Sum)(using Envri): Future[(StaticCollection, Seq[Sha256Sum])] =
uploadService.meta.lookupCollection(collHash).flatMap: coll =>
Future
.sequence:
coll.members.map:
case pso: PlainStaticObject => Future.successful(Seq(pso.hash))
case psc: PlainStaticCollection =>
collectCollObjectHashes(psc.hash).map(_._2)
.map(_.flatten)
.map(coll -> _)


private val collectionDownload: Route = requireShaHash{ hashsum =>
extractEnvri{
onSuccess(uploadService.meta.lookupCollection(hashsum)){ coll =>

val hashes = collectMembers(coll).map(_.hash)
onSuccess(collectCollObjectHashes(hashsum)){ (coll, hashes) =>

val licenceCheck = batchLicenceCheck(hashes, _.contains(hashsum)){licUris =>
//TODO Make the licence-accept redirect convey the list of licences
Expand Down Expand Up @@ -361,11 +371,6 @@ object DownloadRouting{
def withBestAvailableIp(userProvidedIp: Option[String]): Directive1[String] =
userProvidedIp.flatMap(toGoodIpAddress).fold(getClientIp)(provide)

def collectMembers(item: StaticDataItem): Seq[PlainStaticObject] = item match{
case pso: PlainStaticObject => Seq(pso)
case coll: StaticCollection => coll.members.flatMap(collectMembers)
}

private val extractHashsums: Directive1[Seq[Sha256Sum]] = extractStrictEntity(1.second).flatMap{entity =>
try{
provide{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class StatsIndex(sizeHint: Int):
val dlYearIndices = mutable.Map.empty[Int, MutableRoaringBitmap]
val downloadedObjects = BufferWithDefault[Int](sizeHint, 0)
val downloadInstants = BufferWithDefault[Long](sizeHint, -1L)
val dlTimeIndex = DatetimeHierarchicalBitmap(downloadInstants.apply)
val dlTimeIndex =
val dtGeo = DatetimeHierarchicalBitmap.DateTimeGeo(downloadInstants.apply)
DatetimeHierarchicalBitmap(dtGeo)
val isWhiteDownload = new MutableRoaringBitmap
val allDownloads = new MutableRoaringBitmap
var countDobj: Int = 0
Expand Down

0 comments on commit 0992c55

Please sign in to comment.