(this._userStateModel ne null)
}
+ private[this] def isInitial = this._userStateModel.isInitial
+
/**
* Creates the agreement history from all the stored IMEvents.
*
this._userStateModel.updateUserAgreementHistoryMsg(historyMsg)
}
}
+
+ private[this] def checkInitial(nextThing: () ⇒ Any = () ⇒ {}): Boolean = {
+ if(!isInitial) {
+ return false
+ }
+
+ val (userCreated, imEventsCount) = createUserAgreementHistoryFromIMEvents(userID)
+
+ if(userCreated) {
+ loadLastKnownUserStateAndUpdateAgreements(this._userStateModel.userAgreementHistoryMsg)
+ }
+
+ nextThing()
+
+ true
+ }
+
/**
* Processes [[gr.grnet.aquarium.message.avro.gen.IMEventMsg]]s that come directly from the
* messaging hub (rabbitmq).
*/
def onIMEventMsg(imEvent: IMEventMsg) {
+ if(checkInitial()) {
+ return
+ }
+
// Check for out of sync (regarding IMEvents)
val isOutOfSyncIM = imEvent.getOccurredMillis < this._userStateModel.latestIMEventOccurredMillis
if(isOutOfSyncIM) {
}
def onResourceEventMsg(rcEvent: ResourceEventMsg) {
+ if(checkInitial()) {
+ return
+ }
+
if(!haveUserCreationEvent) {
DEBUG("No agreements. Ignoring %s", rcEvent)
}
def onGetUserBillRequest(event: GetUserBillRequest): Unit = {
+ checkInitial()
+
try{
val timeslot = event.timeslot
val resourceTypes: Map[String, ResourceType] = aquarium.policyStore.
}
def onGetUserBalanceRequest(event: GetUserBalanceRequest): Unit = {
+ checkInitial()
+
val userID = event.userID
(haveAgreements, haveUserState) match {
}
def onGetUserStateRequest(event: GetUserStateRequest): Unit = {
+ checkInitial()
+
haveUserState match {
case true ⇒
val realtimeMillis = TimeHelpers.nowMillis()
}
def onGetUserWalletRequest(event: GetUserWalletRequest): Unit = {
+ checkInitial()
+
haveUserState match {
case true ⇒
DEBUG("haveWorkingUserState: %s", event)
TimeHelpers.nowMillis()
)
- val (userCreated, imEventsCount) = createUserAgreementHistoryFromIMEvents(userID)
- if(userCreated) {
- loadLastKnownUserStateAndUpdateAgreements(this._userStateModel.userAgreementHistoryMsg)
- }
+ require(this._userStateModel.isInitial, "this._userStateModel.isInitial")
}
private[this] def D_userID = {