GNU bug report logs -
#60788
[PATCH] services: Add vnstat-service-type.
Previous Next
Reported by: Bruno Victal <mirai <at> makinata.eu>
Date: Fri, 13 Jan 2023 20:09:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello!
Bruno Victal <mirai <at> makinata.eu> skribis:
>>> +@item @code{database-dir} (default: @code{"/var/lib/vnstat"}) (type: string)
>>
>> [...]
>>
>>> +@item @code{create-dirs?} (default: @code{#t}) (type: maybe-boolean)
>>
>> For consistency, both within this record and with the rest of Guix, I
>> suggest avoiding abbreviations. Since this will be part of the API,
>> better fix it now than later.
>
> I should mention that almost all of the field names here are near verbatim
> vnstat config-file directives, i.e. a near 1-1 Scheme translation of vnstat config.
> This has the benefit that it makes serialization pretty much straightforward.
>
> It's possible to override their names by the use of the custom serializer parameter
> but would it be acceptable to leave them as-is?
Hmm, I’d say that if the cost of using “nice names” is “really high”,
then yes. But perhaps we can make that cost low by having a map for the
few cases where we use a name different from upstream?
(define field-name-mapping
'((database-directory . "database_dir") …))
> (define-module (gnu tests vnstat)
Woohoo, you rock!
> (test-assert "vnstatd is logging"
> ;; pump garbage into the "discard" service within the vm
> ;; TODO: guile socket client instead? Is it feasible?
> (let* ((socat #$(file-append socat "/bin/socat"))
> (dest-addr #$(format #f "TCP4:localhost:~d"
> forwarded-port))
> (args `("socat" "-u" "/dev/zero" ,dest-addr))
> ;; XXX: Guile bug (22/03/2023, Guile 3.0.9)
> ;; Fixed in main: <https://issues.guix.gnu.org/61073>
> #;(output-port (%make-void-port "w"))
> (garbage-pump-pid (spawn socat args)))
You can probably connect directly to DEST-ADDR from Guile instead of
going through ‘socat’?
If not, you can either pass ‘#:guile guile-3.0-latest’ to
‘gexp->derivation’ so you get ‘spawn’ (3.0.9 is the default in
‘core-updates’ anyway), or use ‘primitive-fork’.
HTH!
Ludo’.
This bug report was last modified 2 years and 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.