forked from Hornetlabs/synchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplication_agent.h
More file actions
58 lines (50 loc) · 1.68 KB
/
replication_agent.h
File metadata and controls
58 lines (50 loc) · 1.68 KB
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
/*
* replication_agent.h
*
* Header file for the SynchDB replication agent
*
* This file defines the data structures and function prototypes
* used by the replication agent to handle DDL and DML operations
* in PostgreSQL format.
*
* Key components:
* - Structures for representing DDL and DML operations
* - Function prototypes for executing DDL and DML operations
*
* Copyright (c) 2024 Hornetlabs Technology, Inc.
*
*/
#ifndef SYNCHDB_REPLICATION_AGENT_H_
#define SYNCHDB_REPLICATION_AGENT_H_
#include "executor/tuptable.h"
#include "synchdb.h"
/* Data structures representing PostgreSQL data formats */
typedef struct pg_ddl
{
char * ddlquery; /* to be fed into SPI*/
} PG_DDL;
typedef struct pg_ddl_column_value
{
char * value; /* string representation of column values that
* is processed and ready to be used to built
* into TupleTableSlot.
*/
Oid datatype;
int position; /* position of this value's attribute in tupdesc */
} PG_DML_COLUMN_VALUE;
typedef struct pg_dml
{
char * dmlquery; /* to be fed into SPI */
char op;
Oid tableoid;
List * columnValuesBefore; /* list of PG_DML_COLUMN_VALUE */
List * columnValuesAfter; /* list of PG_DML_COLUMN_VALUE */
} PG_DML;
/* Function prototypes */
int ra_executePGDDL(PG_DDL * pgddl, ConnectorType type);
int ra_executePGDML(PG_DML * pgdml, ConnectorType type, SynchdbStatistics * myBatchStats);
int ra_getConninfoByName(const char * name, ConnectionInfo * conninfo, char ** connector);
int ra_executeCommand(const char * query);
int ra_listConnInfoNames(char ** out, int * numout);
char * ra_transformDataExpression(char * data, char * wkb, char * srid, char * expression);
#endif /* SYNCHDB_REPLICATION_AGENT_H_ */