ExPool v0.1.1 ExPool.State.Monitors

Data structure to store references to all processes related to the pool and the role they play.

This module defines a ExPool.State.Monitors struct and the main functions to manipulate it.

Fields

  • table - ets table to store all role, process and reference relations

Summary

Functions

Adds the given item and its associated reference

Removes the given item and its associated reference

Gets an item from its reference

Creates a new Monitors struct

Gets a reference from its item

Types

item :: any
ref :: reference
t :: %ExPool.State.Monitors{table: table}
table :: :ets.tid

Functions

add(monitors, item, ref)

Specs

add(t, item, ref) :: t

Adds the given item and its associated reference.

forget(monitors, item)

Specs

forget(t, item) :: t

Removes the given item and its associated reference

item_from_ref(monitors, ref)

Specs

item_from_ref(t, ref) :: {:ok, item} | :not_found

Gets an item from its reference.

new(config)

Specs

new(config :: [Keyword]) :: t

Creates a new Monitors struct.

ref_from_item(monitors, item)

Specs

ref_from_item(t, item) :: {:ok, ref} | :not_found

Gets a reference from its item.