-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameStore.java
37 lines (31 loc) · 877 Bytes
/
GameStore.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.achur.avalon.storage;
import com.achur.avalon.entity.Game;
import com.google.common.base.Function;
/**
* Handles storing and updating {@link Game} objects.
*/
public interface GameStore {
/**
* Gets the game from the datastore.
*
* @param id The ID of the game.
* @return The game fetched from the datastore.
*/
public Game getGame(Long id);
/**
* Persists the game to the datastore.
*
* @param game The game to persist.
* @return The game that was persisted.
*/
public Game saveGame(Game game);
/**
* Performs an atomic modification to a game.
*
* @param id The ID of the game to modify.
* @param modifier A function that modifies the Game which will be
* executed atomically for each game.
* @return The modified game.
*/
public Game modifyGame(Long id, Function<Game, Game> modifier);
}