Find all relevant resource event for billing period
authorChristos KK Loverdos <loverdos@gmail.com>
Fri, 24 Feb 2012 13:08:58 +0000 (15:08 +0200)
committerChristos KK Loverdos <loverdos@gmail.com>
Fri, 24 Feb 2012 13:08:58 +0000 (15:08 +0200)
There is still work to do there, esp the MongoDB implementation.

src/main/scala/gr/grnet/aquarium/store/ResourceEventStore.scala
src/main/scala/gr/grnet/aquarium/store/memory/MemStore.scala
src/main/scala/gr/grnet/aquarium/store/mongodb/MongoDBStore.scala

index 908d5c2..5902948 100644 (file)
@@ -71,7 +71,7 @@ trait ResourceEventStore {
   /**
    * Finds all relevant resource events for the billing period.
    * The relevant events are those:
-   * a) whose `occurredMillis` is within the given billing period and
+   * a) whose `occurredMillis` is within the given billing period or
    * b) whose `receivedMillis` is within the given billing period.
    *
    * Order them by `occurredMillis`
@@ -79,6 +79,5 @@ trait ResourceEventStore {
    */
   def findAllRelevantResourceEventsForBillingPeriod(userId: String,
                                                     startMillis: Long,
-                                                    stopMillis: Long): List[ResourceEvent] =
-    findResourceEventsForReceivedPeriod(userId, startMillis, stopMillis)
+                                                    stopMillis: Long): List[ResourceEvent]
 }
\ No newline at end of file
index 30c932c..d900dae 100644 (file)
@@ -224,8 +224,7 @@ class MemStore extends UserStateStore
                                           stopTimeMillis: Long): List[ResourceEvent] = {
     resourceEventsById.valuesIterator.filter { ev ⇒
       ev.userId == userId &&
-      ev.receivedMillis >= startTimeMillis &&
-      ev.receivedMillis <= stopTimeMillis
+      ev.isReceivedWithinMillis(startTimeMillis, stopTimeMillis)
     }.toList
   }
 
index f3f059c..6648a30 100644 (file)
@@ -182,6 +182,12 @@ class MongoDBStore(
     }
   }
 
+  def findAllRelevantResourceEventsForBillingPeriod(userId: String,
+                                                    startMillis: Long,
+                                                    stopMillis: Long): List[ResourceEvent] = {
+    // FIXME: Implement
+    Nil
+  }
   //-ResourceEventStore
 
   //+ UserStateStore