On 2020-Apr-22, Andres Freund wrote: > On 2020-04-22 13:57:54 -0400, Alvaro Herrera wrote: > > Concretely, I propose to have a new struct like > > > > typedef struct xlogReaderFuncs > > { > > XLogPageReadCB read_page; > > XLogSegmentOpenCB open_segment; > > XLogSegmentCloseCB open_segment; > > } xlogReaderFuncs; > > > > #define XLOGREADER_FUNCS(...) &(xlogReaderFuncs){__VA_ARGS__} > > Not sure I quite see the point of that helper macro...
Avoid the ugly cast -- same discussion we had for ARCHIVE_OPTS in pg_dump code in commit f831d4accda0. > ISTM that we should: > - have the three callbacks you mention above > - change WALSegmentOpen to also get the XLogReaderState > - add private state to WALOpenSegment, so it can be used even when not > accessing data in files / when one needs more information to close the > file. > - disambiguate between WALOpenSegment (struct describing an open > segment) and WALSegmentOpen (callback to open a segment) (note that > the read page callback uses a *CB naming, why not follow?) Sounds good. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services