memory

package
v0.0.0-...-6b15219 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package memory is a storage manager that just keeps the games and storage in memory, which means that when the program exits the storage evaporates. Useful in cases where you don't want a persistent store (e.g. testing or fast iteration). Implements both boardgame.StorageManager and boardgame/server.StorageManager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageManager

type StorageManager struct {
	*helpers.ExtendedMemoryStorageManager
	// contains filtered or unexported fields
}

StorageManager is the primary type of this package. Get a new one with NewStorageManager.

func NewStorageManager

func NewStorageManager() *StorageManager

NewStorageManager is the way to get a new StorageManager.

func (*StorageManager) AllGames

func (s *StorageManager) AllGames() []*boardgame.GameStorageRecord

AllGames implements the extra method that storage/internal/helpers needs.

func (*StorageManager) Game

Game implements that part of the core storage interface

func (*StorageManager) ListGames

func (s *StorageManager) ListGames(max int, list listing.Type, userID string, gameType string) []*extendedgame.CombinedStorageRecord

ListGames will return game objects for up to max number of games

func (*StorageManager) Move

func (s *StorageManager) Move(gameID string, version int) (*boardgame.MoveStorageRecord, error)

Move implements that part of the core storage interface

func (*StorageManager) Moves

func (s *StorageManager) Moves(gameID string, fromVersion, toVersion int) ([]*boardgame.MoveStorageRecord, error)

Moves implements that part of the core storage interface

func (*StorageManager) Name

func (s *StorageManager) Name() string

Name returns 'memory'

func (*StorageManager) SaveGameAndCurrentState

SaveGameAndCurrentState implements that part of the core storage interface

func (*StorageManager) State

func (s *StorageManager) State(gameID string, version int) (boardgame.StateStorageRecord, error)

State implements that part of the core storage interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL