View Source sidejob_worker (sidejob v2.2.0)

This module implements the sidejob_worker logic used by all worker processes created to manage a sidejob resource. This code emulates the gen_server API, wrapping a provided user-specified module which implements the gen_server behavior.

The primary purpose of this module is updating the usage information published in a given resource's ETS table, such that capacity limiting operates correctly. The sidejob_worker also cooperates with a given sidejob_resource_stats server to maintain statistics about a given resource.

By default, a sidejob_worker calculates resource usage based on message queue size. However, the user-specified module can also choose to implement the current_usage/1 and rate/1 callbacks to change how usage is calculated. An example is the sidejob_supervisor module which reports usage as: queue size + num_children.

Summary

Functions

Link to this function

code_change(OldVsn, State, Extra)

View Source
Link to this function

handle_call(Request, From, State)

View Source
Link to this function

handle_cast(Request, State)

View Source
Link to this function

handle_info(Info, State)

View Source
Link to this function

start_link(RegName, ResName, Id, ETS, StatsName, Mod)

View Source
Link to this function

terminate(Reason, State)

View Source