Cauldron2D.Arenas.Table (Cauldron2D v0.1.4)

Copy Markdown View Source

The registered arenas, one record each, in an ETS table this process owns.

Cauldron2D.Arenas.Table.put(:pit, %{id: :pit, opts: [game: MyGame], listing: %{name: "The Pit"}})
Cauldron2D.Arenas.Table.all()
Cauldron2D.Arenas.Table.listings()

A record's listing is kept beside it so listings/0 reads the listings alone, leaving the records — a game's options can be large — where they are.

Summary

Functions

Every arena's record.

Returns a specification to start this module under a supervisor.

Forget arena id.

The record of arena id, or nil.

Every arena's id with its listing, copying nothing else of the records.

Record arena id; record.listing, when there is one, is what listings/0 returns for it.

Functions

all()

@spec all() :: [map()]

Every arena's record.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(id)

@spec delete(term()) :: :ok

Forget arena id.

get(id)

@spec get(term()) :: map() | nil

The record of arena id, or nil.

listings()

@spec listings() :: [{term(), map()}]

Every arena's id with its listing, copying nothing else of the records.

put(id, record)

@spec put(term(), map()) :: :ok

Record arena id; record.listing, when there is one, is what listings/0 returns for it.