genserver

Much of the work you think of as the core of a program - calculating results, storing information, and preparing replies - will fit neatly into the gen_server behavior. It provides a core set of methods that let you set up a process, respond to requests, end the process gracefully, and even pass state to a new process if this one needs to be upgraded in place. (Laurent 2017, 148)

gen_server is a generic server process that implements a standard set of interface functions and functionality for tracing and error reporting, it also fits an OTP supervision tree.

The gen_server behaviour interface contains six functions:

References:

Laurent, Simon St. 2017. Introducing Erlang: Getting Started in Functional Programming. O’Reilly Media, Inc.

Backlinks: