Próximo: , Acima: Definindo serviços   [Conteúdo][Índice]

11.19.1 Composição de serviço

Here we define a service as, broadly, something that extends the functionality of the operating system. Often a service is a process—a daemon—started when the system boots: a secure shell server, a Web server, the Guix build daemon, etc. Sometimes a service is a daemon whose execution can be triggered by another daemon—e.g., an FTP server started by inetd or a D-Bus service activated by dbus-daemon. Occasionally, a service does not map to a daemon. For instance, the “account” service collects user accounts and makes sure they exist when the system runs; the “udev” service collects device management rules and makes them available to the eudev daemon; the /etc service populates the /etc directory of the system.

Guix system services are connected by extensions. For instance, the secure shell service extends the Shepherd—the initialization system, running as PID 1—by giving it the command lines to start and stop the secure shell daemon (veja openssh-service-type); the UPower service extends the D-Bus service by passing it its .service specification, and extends the udev service by passing it device management rules (veja upower-service); the Guix daemon service extends the Shepherd by passing it the command lines to start and stop the daemon, and extends the account service by passing it a list of required build user accounts (veja Serviços base).

All in all, services and their “extends” relations form a directed acyclic graph (DAG). If we represent services as boxes and extensions as arrows, a typical system might provide something like this:

Typical service extension graph.

At the bottom, we see the system service, which produces the directory containing everything to run and boot the system, as returned by the guix system build command. Veja Referência de Service, to learn about the other service types shown here. Veja the guix system extension-graph command, for information on how to generate this representation for a particular operating system definition.

Technically, developers can define service types to express these relations. There can be any number of services of a given type on the system—for instance, a system running two instances of the GNU secure shell server (lsh) has two instances of lsh-service-type, with different parameters.

The following section describes the programming interface for service types and services.

Próximo: Tipos de Service e Serviços, Acima: Definindo serviços   [Conteúdo][Índice]