diff mbox series

[bug#43771,3/5] Remove the postgresql-service procedure

Message ID 20201002184059.29033-3-mail@cbaines.net
State Accepted
Headers show
Series PostgreSQL service improvements | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Christopher Baines Oct. 2, 2020, 6:40 p.m. UTC
It's unnecessary, using the service type directly is a better approach. While
this is unfortunately a breaking change, I'm also looking at making breaking
changes to the service type configuration, so I don't think this can be
avoided.
---
 doc/guix.texi              | 40 +++++++++++++++++++++++++++++---------
 gnu/services/databases.scm | 19 ------------------
 2 files changed, 31 insertions(+), 28 deletions(-)

Comments

Ludovic Courtès Oct. 5, 2020, 8:33 a.m. UTC | #1
Hi,

Christopher Baines <mail@cbaines.net> skribis:

> It's unnecessary, using the service type directly is a better approach. While
> this is unfortunately a breaking change, I'm also looking at making breaking
> changes to the service type configuration, so I don't think this can be
> avoided.

[...]

> -(define* (postgresql-service #:key (postgresql postgresql)
> -                             (port 5432)
> -                             (locale "en_US.utf8")

Here I’d suggest to keep it as ‘define-deprecated’, like we did for
other such procedures.

Otherwise LGTM.

Thanks,
Ludo’.
Christopher Baines Oct. 19, 2020, 7:01 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> It's unnecessary, using the service type directly is a better approach. While
>> this is unfortunately a breaking change, I'm also looking at making breaking
>> changes to the service type configuration, so I don't think this can be
>> avoided.
>
> [...]
>
>> -(define* (postgresql-service #:key (postgresql postgresql)
>> -                             (port 5432)
>> -                             (locale "en_US.utf8")
>
> Here I’d suggest to keep it as ‘define-deprecated’, like we did for
> other such procedures.

Ah, yeah, I discounted that initially, as I didn't see a way to adapt it
to the new behaviour, but the deprecated procedure can just have the old
behaviour.

I'll send some updated patches with it deprecated.
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 4197cd562a..641b410acf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17738,15 +17738,12 @@  The @code{(gnu services databases)} module provides the following services.
 
 @subsubheading PostgreSQL
 
-@deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @
-       [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @
-       [#:port 5432] [#:locale ``en_US.utf8''] [#:extension-packages '()]
-Return a service that runs @var{postgresql}, the PostgreSQL database
-server.
+The following example describes a PostgreSQL service with the default
+configuration.
 
-The PostgreSQL daemon loads its runtime configuration from @var{config-file},
-creates a database cluster with @var{locale} as the default
-locale, stored in @var{data-directory}.  It then listens on @var{port}.
+@lisp
+(service postgresql-service-type)
+@end lisp
 
 If the services fails to start, it may be due to an incompatible
 cluster already present in @var{data-directory}.  Adjust it (or, if you
@@ -17766,6 +17763,29 @@  createuser --interactive
 createdb $MY_USER_LOGIN      # Replace appropriately.
 @end example
 
+@deftp {Data Type} postgresql-configuration
+Data type representing the configuration for the
+@code{postgresql-service-type}.
+
+@table @asis
+@item @var{postgresql} (default: @code{postgresql})
+PostgreSQL package to use for the service.
+
+@item @var{port} (default: @code{5432})
+Port on which PostgreSQL should listen.
+
+@item @var{locale} (default: @code{"en_US.utf8"})
+Locale to use as the default when creating the database cluster.
+
+@item @var{config-file} (default: @code{(postgresql-config-file)})
+The configuration file to use when running PostgreSQL.  The default
+behaviour uses the postgresql-config-file record with the default values
+for the fields.
+
+@item @var{data-directory} (default: @code{"/var/lib/postgresql/data"})
+Directory in which to store the data.
+
+@item @var{extension-packages} (default: @code{'()})
 @cindex postgresql extension-packages
 Additional extensions are loaded from packages listed in
 @var{extension-packages}.  Extensions are available at runtime.  For instance,
@@ -17801,7 +17821,9 @@  psql -U postgres
 There is no need to add this field for contrib extensions such as hstore or
 dblink as they are already loadable by postgresql.  This field is only
 required to add extensions provided by other packages.
-@end deffn
+
+@end table
+@end deftp
 
 @subsubheading MariaDB/MySQL
 
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 2bddf70f71..efad182a68 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -281,25 +281,6 @@  host	all	all	::1/128 	md5"))
                                           (compose list postgresql-configuration-postgresql))))
                 (default-value (postgresql-configuration))))
 
-(define* (postgresql-service #:key (postgresql postgresql)
-                             (port 5432)
-                             (locale "en_US.utf8")
-                             (config-file (postgresql-config-file))
-                             (data-directory "/var/lib/postgresql/data")
-                             (extension-packages '()))
-  "Return a service that runs @var{postgresql}, the PostgreSQL database server.
-
-The PostgreSQL daemon loads its runtime configuration from @var{config-file}
-and stores the database cluster in @var{data-directory}."
-  (service postgresql-service-type
-           (postgresql-configuration
-            (postgresql postgresql)
-            (port port)
-            (locale locale)
-            (config-file config-file)
-            (data-directory data-directory)
-            (extension-packages extension-packages))))
-
 
 ;;;
 ;;; Memcached