This repository was archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot_route.c
More file actions
51 lines (41 loc) · 1.28 KB
/
root_route.c
File metadata and controls
51 lines (41 loc) · 1.28 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
#include "unistd.h"
#include "postgres.h"
/* These are always necessary for a bgworker */
#include "miscadmin.h"
/* these headers are used by this particular worker's code */
#include "access/xact.h"
#include "executor/spi.h"
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "pgstat.h"
#include "utils/builtins.h"
#include "utils/snapmgr.h"
#include "utils/memutils.h"
#include "tcop/utility.h"
#include "libpq/libpq.h"
#include "catalog/pg_database.h"
#include "catalog/indexing.h"
#include "utils/fmgroids.h"
#include "access/htup_details.h"
#include "storage/lmgr.h"
#include <event2/http.h>
#include <event2/util.h>
#include <event2/keyvalq_struct.h>
#include "routes.h"
#include "jsonbuf.h"
#include "util.h"
#include "content_types.h"
void
root_route_GET(struct restgres_request *req)
{
struct jsonbuf *jp = req->jsonbuf;
jsonbuf_start_document(jp);
jsonbuf_member_cstring(jp, "version", PG_VERSION_STR);
jsonbuf_member_start_array(jp, "links");
jsonbuf_element_link(jp, "self", SERVER_METADATA_TYPE_V1, "/");
jsonbuf_element_link(jp, "tablespaces", TABLESPACE_LIST_TYPE_V1, "/tablespaces");
jsonbuf_element_link(jp, "databases", DATABASE_LIST_TYPE_V1, "/databases");
jsonbuf_element_link(jp, "roles", ROLE_LIST_TYPE_V1, "/roles");
jsonbuf_end_array(jp);
jsonbuf_end_document(jp);
}