Re: Pluggable Storage - Andres's take - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Pluggable Storage - Andres's take
Date
Msg-id 20190115164513.ug6l4n56tus2uhrc@alap3.anarazel.de
Whole thread Raw
In response to Re: Pluggable Storage - Andres's take  (Amit Khandekar <amitdkhan.pg@gmail.com>)
List pgsql-hackers
Hi,

On 2019-01-15 14:37:36 +0530, Amit Khandekar wrote:
> Then for each of the calls, we would need to declare that structure
> variable (with = {0}) and assign required fields in that structure
> before passing it to ArchiveEntry(). But a major reason of
> ArchiveEntry() is to avoid doing this and instead conveniently pass
> those fields as parameters. This will cause unnecessary more lines of
> code. I think better way is to have an ArchiveEntry() function with
> limited number of parameters, and have an ArchiveEntryEx() with those
> extra parameters which are not needed in usual cases.

I don't think that'll really solve the problem. I think it might be more
reasonable to rely on structs. Now that we can rely on designated
initializers for structs we can do something like

    ArchiveEntry((ArchiveArgs){.tablespace = 3,
                               .dumpFn = somefunc,
                               ...});

and unused arguments will automatically initialized to zero.  Or we
could pass the struct as a pointer, might be more efficient (although I
doubt it matters here):

    ArchiveEntry(&(ArchiveArgs){.tablespace = 3,
                                .dumpFn = somefunc,
                                ...});

What do others think?  It'd probably be a good idea to start a new
thread about this.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Maksim Milyutin
Date:
Subject: Re: O_DIRECT for relations and SLRUs (Prototype)
Next
From: Adrien NAYRAT
Date:
Subject: Re: Log a sample of transactions