Quick commit before delving into python stuff. See you later. snapshots
authorChristos KK Loverdos <loverdos@gmail.com>
Fri, 5 Oct 2012 08:08:58 +0000 (11:08 +0300)
committerChristos KK Loverdos <loverdos@gmail.com>
Fri, 5 Oct 2012 08:08:58 +0000 (11:08 +0300)
src/main/avro/aquarium-user-state.avdl
src/main/scala/gr/grnet/aquarium/actor/service/user/UserActor.scala
src/main/scala/gr/grnet/aquarium/charging/state/UserStateModel.scala
src/main/scala/gr/grnet/aquarium/util/date/TimeHelpers.scala

index c961e9d..cbe88c8 100644 (file)
@@ -58,10 +58,10 @@ protocol AquariumUserState {
     map<AnyValueMsg> details;
     array<ResourceEventMsg> previousEvents;
     array<ResourceEventMsg> implicitlyIssuedStartEvents;
-   string accumulatingAmount;
-   string oldAccumulatingAmount;
-   string previousValue;
-   string currentValue;
+    string accumulatingAmount;
+    string oldAccumulatingAmount;
+    string previousValue;
+    string currentValue;
   }
 
   record ResourcesChargingStateMsg {
index 0503b97..d7604cc 100644 (file)
@@ -190,6 +190,11 @@ class UserActor extends ReflectiveRoleableActor {
 
   private[this] def processResourceEventsAfterLastKnownUserState() {
     // Update the user state snapshot with fresh (ie not previously processed) events.
+    aquarium.resourceEventStore.foreachResourceEventOccurredInPeriod(
+      this._userStateModel.userID,
+      this._userStateModel.latestResourceEventOccurredMillis,
+      TimeHelpers.nowMillis()
+    )
   }
 
   private[this] def makeUserStateMsgUpToDate() {
index 1f7b0f5..f48fa59 100644 (file)
@@ -155,7 +155,9 @@ final class UserStateModel(
     _userAgreementModels.lastOption
   }
 
-  def latestResourceEventOccurredMillis = this._userStateMsg.getLatestResourceEventOccurredMillis
+  def latestResourceEventOccurredMillis = {
+    this._userStateMsg.getLatestResourceEventOccurredMillis
+  }
 
   @inline final def totalCreditsAsReal: Real = Real(this._userStateMsg.getTotalCredits)
 
index 3b01d03..35b7432 100644 (file)
@@ -44,12 +44,12 @@ import org.joda.time.MutableDateTime
  * @author Christos KK Loverdos <loverdos@gmail.com>
  */
 
-object TimeHelpers {
+final object TimeHelpers {
   @inline
-  def nowMillis() = System.currentTimeMillis()
+  final def nowMillis() = System.currentTimeMillis()
 
   @inline
-  def nowDate = new Date(nowMillis())
+  final def nowDate = new Date(nowMillis())
 
   def secDiffOfMillis(ms0: Long, ms1: Long) = (ms1 - ms0).toDouble / 1000.0