31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package storage
|
|
|
|
import "github.com/iliadenisov/galaxy/pkg/game"
|
|
|
|
// games/
|
|
// data.json - id, name, turn, schedule, status
|
|
// game123/
|
|
// race/<race_id>/data.json - account_id, name, status, war/peace(?), last_order, etc.
|
|
// order/<turn>/<race_id>/0.json - incoming orders
|
|
// turn/12/log/ - ?
|
|
// turn/12/order/<race_id>/0.json - processed orders
|
|
// turn/12/state/0.json - initital, contains <battle_numbers> for planet
|
|
// state/<1...N>.json - instant commands changes state
|
|
// turn/12/report/global.json
|
|
// report/<race_id>.json
|
|
// turn/12/battle/<planet_id>/<battle_number>.json
|
|
|
|
type Storage interface {
|
|
GenerateRaceId() game.RaceIdentifier
|
|
GenerateGameId() game.GameIdentifier
|
|
|
|
CreateGame(game.GameParameter) (game.Game, error)
|
|
ListGames() ([]game.GameIdentifier, error)
|
|
|
|
LoadRace(game_id game.GameIdentifier, race_id game.RaceIdentifier) (game.Race, error)
|
|
SaveRace(game_id game.GameIdentifier, race game.Race) error
|
|
|
|
LoadState(game_id game.GameIdentifier) (game.Game, error)
|
|
SaveState(game game.Game) error
|
|
}
|