billingMonth: Int,
resourceEvents: List[ResourceEvent], // current is at the head
chargeslots: List[Chargeslot],
- resourceDef: DSLResource) {
+ resourceDef: DSLResource,
+ isSynthetic: Boolean) {
def currentResourceEvent = resourceEvents.head
def resource = currentResourceEvent.resource
def chargslotCount = chargeslots.length
def isOutOfSync = currentResourceEvent.isOutOfSyncForBillingMonth(yearOfBillingMonth, billingMonth)
- def toDebugString = "%s(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)".format(
+ def toDebugString = "%s(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)".format(
gr.grnet.aquarium.util.shortClassNameOf(this),
userId,
referenceTimeslot,
billingMonth,
resourceEvents,
chargeslots,
- resourceDef)
+ resourceDef,
+ if(isSynthetic) "SYNTHETIC" else ""
+ )
}
object NewWalletEntry {
rc.costPolicy
}
}
+
+ /**
+ * `Synthetic` means that Aquarium has manufactured this resource event for some purpose. For example, the implicitly
+ * issued resource events at the end a a billing period.
+ *
+ * @return `true` iff this resource event is synthetic.
+ */
+ def isSynthetic = {
+ details contains ResourceEvent.JsonNames.details_aquarium_is_synthetic
+ }
}
object ResourceEvent {
else
List(currentResourceEvent),
fullChargeslots,
- dslResource
+ dslResource,
+ currentResourceEvent.isSynthetic
)
clog.debug("New %s", newWalletEntry)
val newWalletEntries = scala.collection.mutable.ListBuffer[NewWalletEntry]()
+ clog.debug("Process all occurred events")
_workingUserState = processResourceEvents(
allResourceEventsForMonth,
_workingUserState,
}
}
+ clog.debug("Process implicitly issued events")
+ _workingUserState = processResourceEvents(
+ allEndEventsBuffer.toList,
+ _workingUserState,
+ userStateWorker,
+ policyStore,
+ calculationReason,
+ billingMonthInfo,
+ newWalletEntries,
+ clogJ
+ )
+
val lastUpdateTime = TimeHelpers.nowMillis
_workingUserState = _workingUserState.copy(