public void processReserveTicketRequest(ReserveTicket reserveTicket, IActorRef sender) { //TODO: //If the reserve request > the available for reservation, reply with false if (reserveTicket.requestQuantity > (this.stateMachine.availableTicketCount - this.stateMachine.reservationLog.totalReserved)) { sender.Tell(new ReserveTicketResponse(false, 0, reserveTicket.requestQuantity, null)); return; } this.logEntries.append(this.currentTerm, reserveTicket.requestQuantity, ENTRY_COMMAND.RESERVE, sender.Path.ToString(), false, string.Empty); this.updatePersistentStorage(); //Update the tentative state this.stateMachine.reserveTicket(sender.Path.ToString(), reserveTicket.requestQuantity, true); this.log.Info(string.Concat(Self.Path.Name, " received reservation request of ", reserveTicket.requestQuantity, " tickets from ", sender.Path.Name)); // int successfullyReservedQuantity = Math.Min(this.stateMachine.availableTicketCount - this.stateMachine.reservedTicketCount, reserveTicket.requestQuantity); // sender.Tell(new ReserveTicketResponse(true, successfullyReservedQuantity, reserveTicket.requestQuantity, null)); }
public void handleReserveTicket(ReserveTicket reserveTicket, IActorRef sender) { this.node.notifyClientOfLeaderAddress(reserveTicket, sender); }
public void handleReserveTicket(ReserveTicket reserveTicket, IActorRef sender) { this.node.processReserveTicketRequest(reserveTicket, sender); }