gen.server module

Example of how to inherit from GenServer:

class MyProcess(GenServer):
    def __init__(self, node) -> None:
        GenServer.__init__(self, node, accepted_calls=['hello'])

    def hello(self):
        return self.pid_
class pyrlang.gen.server.GSM(name, bases, nmspc)

Bases: type

Meta class for GenServer

Looks for functions that have been decorated and adds them to match functions

class pyrlang.gen.server.GenServer

Bases: pyrlang.process.Process

async process_loop()

Polls inbox in an endless loop. .. note:

This will not be executed if the process was constructed with
``passive=True`` (the default). Passive processes should read
their inbox directly from ``self.inbox_``.
timeout(seconds=None)

set the gen_server timeout, will generate inbox Atom('timeout') :param seconds: :return:

class pyrlang.gen.server.GenServerInterface(calling_process: pyrlang.process.Process, destination_pid)

Bases: object

Class that implements an interface for gen_servers

This class is intended to be used in Process instances where gen_server behaviour interaction is necessary.

in a raw form this class is initiated with the calling process instance and the pid of the destination process, then you can make calls and cast:

gsi = GenServerInterface(some_process, remote_pid) await gsi.call(call_request) await gsi.cast(cast_request) gsi.cast_nowait(other_cast_request)

If you want to create an interface you override this class and implement the functions, hiding the gen_server methods, just like in erlang

async call(request, timeout=None)
async cast(request)
cast_nowait(request)