Add TODO for future optimization
authorChristos KK Loverdos <loverdos@gmail.com>
Fri, 25 May 2012 15:24:03 +0000 (18:24 +0300)
committerChristos KK Loverdos <loverdos@gmail.com>
Fri, 25 May 2012 15:24:03 +0000 (18:24 +0300)
src/main/scala/gr/grnet/aquarium/actor/service/user/UserActor.scala

index f6b96c3..f8fbde4 100644 (file)
@@ -97,8 +97,10 @@ class UserActor extends ReflectiveRoleableActor {
   def onActorProviderConfigured(event: ActorProviderConfigured): Unit = {
   }
 
-  private[this] def reloadIMState(userID: String): Unit = {
+  private[this] def createIMState(userID: String): Unit = {
     val store = aquarium.imEventStore
+    // TODO: Optimization: Since IMState only records roles, we should incrementally
+    // TODO:               built it only for those IMEvents that changed the role.
     store.replayIMEventsInOccurrenceOrder(userID) { imEvent ⇒
       logger.debug("Replaying %s".format(imEvent))
 
@@ -118,7 +120,7 @@ class UserActor extends ReflectiveRoleableActor {
 
   def onInitializeUserState(event: InitializeUserState): Unit = {
     logger.debug("Got %s".format(event))
-    reloadIMState(event.userID)
+    createIMState(event.userID)
   }
 
   private[this] def _getAgreementNameForNewUser(imEvent: IMEventModel): String = {