datastore

package
v0.0.0-...-de431f0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrActorDoesntExist = errors.New("actor doesn't exist")
View Source
var ErrActorExists = errors.New("actor already exists")

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Name string

	// Actor's Unique ID
	Id rpg2d.ActorId

	// Location in the world
	Loc coord.Cell

	// Way the actor is facing
	Facing coord.Direction

	// Is Connected to the simulation
	IsConnected chan bool
	// contains filtered or unexported fields
}

func (Actor) Authenticate

func (a Actor) Authenticate(name, password string) bool

Authenticate the credentials for an actor.

func (Actor) CanBeConnected

func (a Actor) CanBeConnected() bool

Check if the actor can be connected.

type Datastore

type Datastore interface {
	ActorExists(name string) (Actor, bool)

	// Can return ErrActorExists if the actor's name
	// already exists in the datastore.
	AddActor(name, password string) (Actor, error)

	// Update the actor that is stored.
	UpdateActor(Actor) error
}

The behavior required to load information about the game world from a remote database.

func NewMemDatastore

func NewMemDatastore() Datastore

An implementation of the Datastore interface that will store all the data in memory. Is safe for concurrency. Data will be lost if process closes.

Jump to

Keyboard shortcuts

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