the-algorithm/tweetypie/server/src/main/scala/com/twitter/tweetypie/store/Flush.scala
twitter-team 01dbfee4c0 Open-sourcing Tweetypie
Tweetypie is the core Tweet service that handles the reading and writing of Tweet data.
2023-05-19 16:20:06 -05:00

35 lines
845 B
Scala

package com.twitter.tweetypie
package store
object Flush extends TweetStore.SyncModule {
case class Event(
tweetIds: Seq[TweetId],
flushTweets: Boolean = true,
flushCounts: Boolean = true,
logExisting: Boolean = true)
extends SyncTweetStoreEvent("flush")
trait Store {
val flush: FutureEffect[Event]
}
trait StoreWrapper extends Store { self: TweetStoreWrapper[Store] =>
override val flush: FutureEffect[Event] = wrap(underlying.flush)
}
object Store {
def apply(
cachingTweetStore: CachingTweetStore,
tweetCountsUpdatingStore: TweetCountsCacheUpdatingStore
): Store =
new Store {
override val flush: FutureEffect[Event] =
FutureEffect.inParallel(
cachingTweetStore.flush,
tweetCountsUpdatingStore.flush
)
}
}
}