mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
b389c3d302
Pushservice is the main recommendation service we use to surface recommendations to our users via notifications. It fetches candidates from various sources, ranks them in order of relevance, and applies filters to determine the best one to send.
16 lines
656 B
Scala
16 lines
656 B
Scala
package com.twitter.frigate.pushservice.store
|
|
|
|
import com.twitter.copyselectionservice.thriftscala._
|
|
import com.twitter.storehaus.ReadableStore
|
|
import com.twitter.util.Future
|
|
|
|
class CopySelectionServiceStore(copySelectionServiceClient: CopySelectionService.FinagledClient)
|
|
extends ReadableStore[CopySelectionRequestV1, Copy] {
|
|
override def get(k: CopySelectionRequestV1): Future[Option[Copy]] =
|
|
copySelectionServiceClient.getSelectedCopy(CopySelectionRequest.V1(k)).map {
|
|
case CopySelectionResponse.V1(response) =>
|
|
Some(response.selectedCopy)
|
|
case _ => throw CopyServiceException(CopyServiceErrorCode.VersionNotFound)
|
|
}
|
|
}
|