Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*-------------------------------------------------------------------------
 *
 * parse_manifest.h
 *    Parse a backup manifest in JSON format.
 *
 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/common/parse_manifest.h
 *
 *-------------------------------------------------------------------------
 */
 
#ifndef PARSE_MANIFEST_H
#define PARSE_MANIFEST_H
 
#include "access/xlogdefs.h"
#include "common/checksum_helper.h"
#include "mb/pg_wchar.h"
 
struct JsonManifestParseContext;
typedef struct JsonManifestParseContext JsonManifestParseContext;
typedef struct JsonManifestParseIncrementalState JsonManifestParseIncrementalState;
 
typedef void (*json_manifest_version_callback) (JsonManifestParseContext *,
                                                int manifest_version);
typedef void (*json_manifest_system_identifier_callback) (JsonManifestParseContext *,
                                                          uint64 manifest_system_identifier);
typedef void (*json_manifest_per_file_callback) (JsonManifestParseContext *,
                                                 const char *pathname,
                                                 uint64 size, pg_checksum_type checksum_type,
                                                 int checksum_length, uint8 *checksum_payload);
typedef void (*json_manifest_per_wal_range_callback) (JsonManifestParseContext *,
                                                      TimeLineID tli,
                                                      XLogRecPtr start_lsn, XLogRecPtr end_lsn);
typedef void (*json_manifest_error_callback) (JsonManifestParseContext *,
                                              const char *fmt, ...) pg_attribute_printf(2, 3);
 
/* [PG_CUSTOM: CFS] */
#ifdef USE_CFS
typedef void (*json_manifest_per_file_cfs_callback) (JsonManifestParseContext *,
                                                     const char *pathname,
                                                     uint64 cfs_epoch,
                                                     uint64 cfs_logical_size);
#endif
 
struct JsonManifestParseContext
{
    void       *private_data;
    json_manifest_version_callback version_cb;
    json_manifest_system_identifier_callback system_identifier_cb;
    json_manifest_per_file_callback per_file_cb;
    json_manifest_per_wal_range_callback per_wal_range_cb;
    json_manifest_error_callback error_cb;
/* [PG_CUSTOM: CFS]
 * Optional; invoked after per_file_cb when the file entry carries the
 * fork-specific "CFS-Epoch" / "CFS-Logical-Size" fields emitted for CFS
 * .cfp sidecar files.  May be NULL.
 */
#ifdef USE_CFS
    json_manifest_per_file_cfs_callback per_file_cfs_cb;
#endif
};
 
extern void json_parse_manifest(JsonManifestParseContext *context,
                                const char *buffer, size_t size);
extern JsonManifestParseIncrementalState *json_parse_manifest_incremental_init(JsonManifestParseContext *context);
extern void json_parse_manifest_incremental_chunk(JsonManifestParseIncrementalState *incstate,
                                                  const char *chunk, size_t size,
                                                  bool is_last);
extern void json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate);
 
#endif