[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Services and log management/monitoring

From: Chris Marusich
Subject: Re: Services and log management/monitoring
Date: Sat, 04 May 2019 00:01:10 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

rendaw <address@hidden> writes:

> I'm fairly sure that's not what it means, but if extends isn't an
> inheritance relationship and it's not a dependency relationship I'm not
> sure what it is.

In this context, when we say that a service A extends a service B, my
understanding is that we mean that A changes (customizes) something
about B.  It is definitely not inheritance.  And because A changes
something about B, I don't think "A depends on B" is the best way to
think about it.

For example, the guix-service-type extends the account-service-type.
The former provides the latter with a list of user and group accounts.
In this way, the guix-service-type tells the account-service-type what
users and groups the guix service needs in order to run.  When you add a
service of the guix-service-type to your operating system declaration's
list of services (it's already there by default), the
account-service-type will know what users and groups are required by the
guix-service-type, and it will create them automatically.  We say the
guix-service-type "extends" the account-service-type because the former
provides the latter with a list of users/groups to create.

That is what we mean by "extension".  Via this "extension" mechanism, it
is possible to make cross-cutting changes that affect many different
parts of the system, without making a bunch of changes to a bunch of
services.  For example, if the tor-service-type also needs to create a
user account and group in order to do its job, it can simply extend the
activation-service-type, just like the guix-service-type did.  And if
something about the way we create user accounts or groups needs to
change, we can change it for all users and groups just by modifying one
place: the account-service-type.

You might be wondering: if the account-service-type is extended by user
and group accounts, how are other services extended?  The answer is that
the type of object used depends on how the services are defined.  The
services participating in the extension define their own contract,
within the confines of the general "extension mechanism" that Guix
provides.  Many services document how they can be extended in the
manual, but some do not, and you might have to look at the source or
existing examples to figure it out, which is not so great.

Note that if you dig into the code, you will find that the term
"extension" can also refer to a specific record type called
<service-extension>, described in the "Service Reference" section of the
manual, and defined in the gnu/services.scm file.  If you want to learn
more about it, I suggest reading the manual and also the source code -
specifically the 'fold-services' procedure in gnu/services.scm, which is
where the actual extension mechanism is implemented.

The manual section is helpful, but due to some word ambiguities, it is a
little difficult to follow the first time through.  Some diagrams could
help a lot in explaining the concepts.  I hope this email helped a


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]