unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Huang\, Ying" <huang_ying_caritas@163.com>
To: Huang Ying <huang.ying.caritas@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH Resend] services: dict.scm: Support more dicod configuration
Date: Wed, 08 Mar 2017 19:12:25 +0800	[thread overview]
Message-ID: <87pohsm38m.fsf@163.com> (raw)
In-Reply-To: <20170307114702.7126-1-huang.ying.caritas@gmail.com> (Huang Ying's message of "Tue, 7 Mar 2017 19:47:02 +0800")

Hi,

Can anyone help me to review this patch?

Best Regards,
Huang, Ying

Huang Ying <huang.ying.caritas@gmail.com> writes:

> * gnu/services/dict.scm (<dicod-configuration>): Rename databases
>   to items to reflect more general configuration.
>   (<dicod-handler>): Add new record type to describe handler (module).
>   (<dicod-database>): Add more fields.
>   (dicod-configuration-file): Support convert more configuration items
>   to config file.
> ---
>  gnu/services/dict.scm | 50 ++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
> index 303067037..628ec9757 100644
> --- a/gnu/services/dict.scm
> +++ b/gnu/services/dict.scm
> @@ -32,6 +32,7 @@
>    #:export (dicod-service
>              dicod-service-type
>              dicod-configuration
> +            dicod-handler
>              dicod-database
>              %dicod-database:gcide))
>  
> @@ -46,21 +47,29 @@
>    (dico        dicod-configuration-dico       (default dico))
>    (interfaces  dicod-configuration-interfaces     ;list of strings
>                 (default '("localhost")))
> -  (databases   dicod-configuration-databases
> -               ;; list of <dicod-database>
> +  (items       dicod-configuration-items
> +               ;; list of <dictod-handler> or <dicod-database>
>                 (default (list %dicod-database:gcide))))
>  
> +(define-record-type* <dicod-handler>
> +  dicod-handler make-dicod-handler
> +  dicod-handler?
> +  (name        dicod-handler-name)
> +  (module      dicod-handler-module          (default #f))
> +  (options     dicod-handler-options         (default '())))
> +
>  (define-record-type* <dicod-database>
>    dicod-database make-dicod-database
>    dicod-database?
>    (name        dicod-database-name)
> -  (module      dicod-database-module)
> +  (handler     dicod-database-handler)
> +  (complex     dicod-database-complex        (default #f))
>    (options     dicod-database-options        (default '())))
>  
>  (define %dicod-database:gcide
>    (dicod-database
>     (name "gcide")
> -   (module "gcide")
> +   (handler "gcide")
>     (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
>                    "idxdir=/var/run/dicod"))))
>  
> @@ -76,23 +85,44 @@
>           (shell (file-append shadow "/sbin/nologin")))))
>  
>  (define (dicod-configuration-file config)
> -  (define database->text
> +  (define item->text
>      (match-lambda
> -      (($ <dicod-database> name module options)
> +      (($ <dicod-handler> name #f '())
> +       `("
> +load-module " ,name ";"))
> +      (($ <dicod-handler> name #f options)
> +       (item->text (dicod-handler
> +                    (name name)
> +                    (module name)
> +                    (options options))))
> +      (($ <dicod-handler> name module options)
> +       `("
> +load-module " ,name " {
> +   command \"" ,module (string-join (list ,@options) " " 'prefix) "\";
> +}\n"))
> +      (($ <dicod-database> name handler #f options)
> +       (append
> +        (item->text (dicod-handler
> +                     (name handler)))
> +        (item->text (dicod-database
> +                     (name name)
> +                     (handler handler)
> +                     (complex #t)
> +                     (options options)))))
> +      (($ <dicod-database> name handler complex options)
>         `("
> -load-module " ,module ";
>  database {
>     name \"" ,name "\";
> -   handler \"" ,module
> +   handler \"" ,handler
>     (string-join (list ,@options) " " 'prefix) "\";
>  }\n"))))
>  
>    (define configuration->text
>      (match-lambda
> -      (($ <dicod-configuration> dico (interfaces ...) databases)
> +      (($ <dicod-configuration> dico (interfaces ...) items)
>         (append `("listen ("
>                   ,(string-join interfaces ", ") ");\n")
> -               (append-map database->text databases)))))
> +               (append-map item->text items)))))
>  
>    (apply mixed-text-file "dicod.conf" (configuration->text config)))

  reply	other threads:[~2017-03-08 11:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 11:47 [PATCH Resend] services: dict.scm: Support more dicod configuration Huang Ying
2017-03-08 11:12 ` Huang, Ying [this message]
2017-03-08 17:10 ` Ludovic Courtès
2017-03-09 11:51   ` Huang, Ying
2017-03-09 12:45     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pohsm38m.fsf@163.com \
    --to=huang_ying_caritas@163.com \
    --cc=guix-devel@gnu.org \
    --cc=huang.ying.caritas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).