60 "{ \"PostgreSQL-Backup-Manifest-Version\": 2,\n"
77 uint64
size, time_t mtime,
80 uint8 *checksum_payload)
82 int pathlen = strlen(manifest_path);
108 (
unsigned long long)
size);
113 "%Y-%m-%d %H:%M:%S %Z",
117 if (mwriter->
buf.
len > 128 * 1024)
120 if (checksum_length > 0)
123 ", \"Checksum-Algorithm\": \"%s\", \"Checksum\": \"",
135 if (mwriter->
buf.
len > 128 * 1024)
156 for (wal_range = first_wal_range; wal_range != NULL;
157 wal_range = wal_range->
next)
159 "%s{ \"Timeline\": %u, \"Start-LSN\": \"%X/%X\", \"End-LSN\": \"%X/%X\" }",
160 wal_range == first_wal_range ?
"" :
",\n",
201 for (p =
str; *p; p++)
227 if ((
unsigned char) *p <
' ')
247 if (mwriter->
fd == -1 &&
258 if (wb != mwriter->
buf.
len)
263 pg_fatal(
"could not write file \"%s\": wrote %d of %d",
271 pg_fatal(
"could not update checksum of file \"%s\"",
287 unsigned n1 = (*src >> 4) & 0xF;
288 unsigned n2 = *src & 0xF;
290 *dst++ = n1 < 10 ?
'0' + n1 :
'a' + n1 - 10;
291 *dst++ = n2 < 10 ?
'0' + n2 :
'a' + n2 - 10;
#define Assert(condition)
char * pg_checksum_type_name(pg_checksum_type type)
int pg_checksum_final(pg_checksum_context *context, uint8 *output)
int pg_checksum_update(pg_checksum_context *context, const uint8 *input, size_t len)
int pg_checksum_init(pg_checksum_context *context, pg_checksum_type type)
void * pg_malloc(size_t size)
#define PG_SHA256_DIGEST_LENGTH
#define PG_SHA256_DIGEST_STRING_LENGTH
static pg_noinline void Size size
void resetStringInfo(StringInfo str)
void appendStringInfo(StringInfo str, const char *fmt,...)
void enlargeStringInfo(StringInfo str, int needed)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
#define appendStringInfoCharMacro(str, ch)
struct manifest_wal_range * next
pg_checksum_context manifest_ctx
int pg_encoding_verifymbstr(int encoding, const char *mbstr, int len)
static void flush_manifest(manifest_writer *mwriter)
manifest_writer * create_manifest_writer(char *directory, uint64 system_identifier)
void add_file_to_manifest(manifest_writer *mwriter, const char *manifest_path, uint64 size, time_t mtime, pg_checksum_type checksum_type, int checksum_length, uint8 *checksum_payload)
static size_t hex_encode(const uint8 *src, size_t len, char *dst)
void finalize_manifest(manifest_writer *mwriter, manifest_wal_range *first_wal_range)
static void escape_json(StringInfo buf, const char *str)
#define LSN_FORMAT_ARGS(lsn)
static const char * directory