the-algorithm/src/scala/com/twitter/simclusters_v2/score/AggregatedScoreStore.scala
twitter-team ef4c5eb65e Twitter Recommendation Algorithm
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
2023-03-31 17:36:31 -05:00

25 lines
952 B
Scala

package com.twitter.simclusters_v2.score
import com.twitter.simclusters_v2.thriftscala.{ScoreId => ThriftScoreId, Score => ThriftScore}
import com.twitter.storehaus.ReadableStore
/**
* A wrapper class, used to aggregate the scores calculated by other score stores. It relies on the
* results of other ScoreStores registered in the ScoreFacadeStore.
*/
trait AggregatedScoreStore extends ReadableStore[ThriftScoreId, ThriftScore] {
// The underlyingScoreStore relies on [[ScoreFacadeStore]] to finish the dependency injection.
protected var scoreFacadeStore: ReadableStore[ThriftScoreId, ThriftScore] = ReadableStore.empty
/**
* When registering this store in a ScoreFacadeStore, the facade store calls this function to
* provide references to other score stores.
*/
private[score] def set(facadeStore: ReadableStore[ThriftScoreId, ThriftScore]): Unit = {
this.synchronized {
scoreFacadeStore = facadeStore
}
}
}