Interface MatchService

All Known Implementing Classes:
UserMatchService

public interface MatchService
Manages instances of Match. This is responsible for retrieving data from the database as well as firing off notifications when Match instances change, or need to be updated. Created by patricktwohig on 7/19/17.
  • Field Details

    • EVENT_1V1_MADE

      static final String EVENT_1V1_MADE
      A match-made event. Indicates that a 1v1 quick match was made.
      See Also:
  • Method Details

    • getMatch

      Match getMatch(String matchId)
      Gets the Match with the specified id.
      Parameters:
      matchId - the Match ID as specified by Match.getId()
      Returns:
      the Match
    • getMatches

      Pagination<Match> getMatches(int offset, int count)
      Gets all matches.
      Parameters:
      offset - the offset
      count - the count
      Returns:
      a Pagination<Match> instance containing the requested data
    • getMatches

      Pagination<Match> getMatches(int offset, int count, String search)
      Gets all matches, specifying search criteria.
      Parameters:
      offset - the offset
      count - the count
      Returns:
      a Pagination<Match> instance containing the requested data
    • createMatch

      Match createMatch(Match match)
      Creates a Match. The supplied Match should have no opponent.
      Parameters:
      match - the Match object
      Returns:
      the Match, as it was written to the database
    • deleteMatch

      void deleteMatch(String matchId)
      Deletes a Match with the supplied ID, as determined by Match.getId().
      Parameters:
      matchId - the match ID
    • attemptRematchAndPoll

      Topic.Subscription attemptRematchAndPoll(String matchId, Consumer<Match> matchConsumer, Consumer<Exception> exceptionConsumer)
      Waits for a Match to be updated by another request. Upon update, this will pass the update into the supplied supplied Consumer. In the event the Match has been deleted, the Consumer will receive a null value indicating so. The returned Subscription need not be closed, unless explicitly requesting un-subscription. .
      Parameters:
      matchId - the match ID Match.getId().
      matchConsumer - a Consumer<Match> used to receive the Match instance
      exceptionConsumer - a Consumer<Exception> used to receive any error encountered in the process
      Returns:
      a Runnable which may be used to cancel the pending request