TuningFork.Store (TuningFork v0.1.11)

Copy Markdown View Source

The ETS tables holding TuningFork.Tick counters and time-stamped TuningFork.State values.

Summary

Functions

Run fun as name's body, playing at frame at.

The frame the body being run is playing at, or 0 outside one.

Returns a specification to start this module under a supervisor.

Empty both tables.

Empty the counters.

Empty the values.

The newest value stored under key at or before frame at, or default. A value set later than at is not seen.

Every key that has a value at or before frame at.

The loop whose body is being run, or nil outside one.

A counter's value without stepping it.

Store value under key as of frame at.

Set a counter.

Step a counter on and give what it was.

Functions

as(name, at, fun)

@spec as(term(), non_neg_integer(), (-> result)) :: result when result: term()

Run fun as name's body, playing at frame at.

TuningFork.Tick.tick/0 then counts on name's own counter, and TuningFork.State.set/2 and get/2 read and write at at.

at()

@spec at() :: non_neg_integer()

The frame the body being run is playing at, or 0 outside one.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear()

@spec clear() :: :ok

Empty both tables.

clear_ticks()

@spec clear_ticks() :: :ok

Empty the counters.

clear_values()

@spec clear_values() :: :ok

Empty the values.

fetch(key, at, default)

@spec fetch(term(), non_neg_integer(), term()) :: term()

The newest value stored under key at or before frame at, or default. A value set later than at is not seen.

keys(at)

@spec keys(non_neg_integer()) :: [term()]

Every key that has a value at or before frame at.

loop()

@spec loop() :: term() | nil

The loop whose body is being run, or nil outside one.

peek(name)

@spec peek(term()) :: non_neg_integer()

A counter's value without stepping it.

put(key, at, value)

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

Store value under key as of frame at.

put_tick(name, count)

@spec put_tick(term(), non_neg_integer()) :: :ok

Set a counter.

step(name)

@spec step(term()) :: non_neg_integer()

Step a counter on and give what it was.