repmgr node status: collate output into list

To make output in different formats (e.g. CSV) easier.
This commit is contained in:
Ian Barwick
2017-07-25 09:27:21 +09:00
parent a793e951b6
commit cbe19d5868
3 changed files with 140 additions and 52 deletions

View File

@@ -31,6 +31,19 @@ typedef struct ItemList
ItemListCell *tail;
} ItemList;
typedef struct KeyValueListCell
{
struct KeyValueListCell *next;
char *key;
char *value;
} KeyValueListCell;
typedef struct KeyValueList
{
KeyValueListCell *head;
KeyValueListCell *tail;
} KeyValueList;
extern int
maxlen_snprintf(char *str, const char *format,...)
@@ -47,6 +60,17 @@ extern void
item_list_append_format(ItemList *item_list, const char *format, ...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
extern void
key_value_list_set(KeyValueList *item_list, const char *key, const char *value);
extern void
key_value_list_set_format(KeyValueList *item_list, const char *key, const char *value, ...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4)));
extern const char *
key_value_list_get(KeyValueList *item_list, const char *key);
extern char *
escape_recovery_conf_value(const char *src);