def isHigherBid()

in pekko-sample-persistence-dc-scala/src/main/scala/sample/persistence/res/auction/Auction.scala [235:250]


    def isHigherBid(first: Bid, second: Bid): Boolean =
      first.offer > second.offer ||
      (first.offer == second.offer && first.timestamp.isBefore(second.timestamp)) || // if equal, first one wins
      // If timestamps are equal, choose by dc where the offer was submitted
      // In real auctions, this last comparison should be deterministic but unpredictable, so that submitting to a
      // particular DC would not be an advantage.
      (first.offer == second.offer && first.timestamp.equals(second.timestamp) && first.originReplica.id
        .compareTo(second.originReplica.id) < 0)
  }

  def apply(
      replica: ReplicaId,
      name: String,
      initialBid: Auction.Bid, // the initial bid is basically the minimum price bidden at start time by the owner
      closingAt: Instant,
      responsibleForClosing: Boolean): Behavior[Command] = Behaviors.setup[Command] { ctx =>