1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 1996,2008 Oracle.  All rights reserved.
5 *
6 * $Id: repmgr_stub.c,v 1.9 2008/01/08 20:58:48 bostic Exp $
7 */
8
9#ifndef HAVE_REPLICATION_THREADS
10#include "db_config.h"
11
12#include "db_int.h"
13
14/*
15 * If the library wasn't compiled with replication support, various routines
16 * aren't available.  Stub them here, returning an appropriate error.
17 */
18static int __db_norepmgr __P((DB_ENV *));
19
20/*
21 * __db_norepmgr --
22 *	Error when a Berkeley DB build doesn't include replication mgr support.
23 */
24static int
25__db_norepmgr(dbenv)
26	DB_ENV *dbenv;
27{
28	__db_errx(dbenv->env,
29    "library build did not include support for the Replication Manager");
30	return (DB_OPNOTSUP);
31}
32
33/*
34 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
35 * PUBLIC: int __repmgr_close __P((ENV *));
36 * PUBLIC: #endif
37 */
38int
39__repmgr_close(env)
40	ENV *env;
41{
42	COMPQUIET(env, NULL);
43	return (0);
44}
45
46/*
47 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
48 * PUBLIC: int __repmgr_add_remote_site
49 * PUBLIC:     __P((DB_ENV *, const char *, u_int, int *, u_int32_t));
50 * PUBLIC: #endif
51 */
52int
53__repmgr_add_remote_site(dbenv, host, port, eidp, flags)
54	DB_ENV *dbenv;
55	const char *host;
56	u_int port;
57	int *eidp;
58	u_int32_t flags;
59{
60	COMPQUIET(host, NULL);
61	COMPQUIET(port, 0);
62	COMPQUIET(eidp, NULL);
63	COMPQUIET(flags, 0);
64	return (__db_norepmgr(dbenv));
65}
66
67/*
68 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
69 * PUBLIC: int __repmgr_get_ack_policy __P((DB_ENV *, int *));
70 * PUBLIC: #endif
71 */
72int
73__repmgr_get_ack_policy(dbenv, policy)
74	DB_ENV *dbenv;
75	int *policy;
76{
77	COMPQUIET(policy, NULL);
78	return (__db_norepmgr(dbenv));
79}
80
81/*
82 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
83 * PUBLIC: int __repmgr_set_ack_policy __P((DB_ENV *, int));
84 * PUBLIC: #endif
85 */
86int
87__repmgr_set_ack_policy(dbenv, policy)
88	DB_ENV *dbenv;
89	int policy;
90{
91	COMPQUIET(policy, 0);
92	return (__db_norepmgr(dbenv));
93}
94
95/*
96 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
97 * PUBLIC: int __repmgr_set_local_site
98 * PUBLIC:     __P((DB_ENV *, const char *, u_int, u_int32_t));
99 * PUBLIC: #endif
100 */
101int
102__repmgr_set_local_site(dbenv, host, port, flags)
103	DB_ENV *dbenv;
104	const char *host;
105	u_int port;
106	u_int32_t flags;
107{
108	COMPQUIET(host, NULL);
109	COMPQUIET(port, 0);
110	COMPQUIET(flags, 0);
111	return (__db_norepmgr(dbenv));
112}
113
114/*
115 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
116 * PUBLIC: int __repmgr_site_list __P((DB_ENV *, u_int *, DB_REPMGR_SITE **));
117 * PUBLIC: #endif
118 */
119int
120__repmgr_site_list(dbenv, countp, listp)
121	DB_ENV *dbenv;
122	u_int *countp;
123	DB_REPMGR_SITE **listp;
124{
125	COMPQUIET(countp, NULL);
126	COMPQUIET(listp, NULL);
127	return (__db_norepmgr(dbenv));
128}
129
130/*
131 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
132 * PUBLIC: int __repmgr_start __P((DB_ENV *, int, u_int32_t));
133 * PUBLIC: #endif
134 */
135int
136__repmgr_start(dbenv, nthreads, flags)
137	DB_ENV *dbenv;
138	int nthreads;
139	u_int32_t flags;
140{
141	COMPQUIET(nthreads, 0);
142	COMPQUIET(flags, 0);
143	return (__db_norepmgr(dbenv));
144}
145
146/*
147 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
148 * PUBLIC: int __repmgr_stat_pp __P((DB_ENV *, DB_REPMGR_STAT **, u_int32_t));
149 * PUBLIC: #endif
150 */
151int
152__repmgr_stat_pp(dbenv, statp, flags)
153	DB_ENV *dbenv;
154	DB_REPMGR_STAT **statp;
155	u_int32_t flags;
156{
157	COMPQUIET(statp, NULL);
158	COMPQUIET(flags, 0);
159	return (__db_norepmgr(dbenv));
160}
161
162/*
163 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
164 * PUBLIC: int __repmgr_stat_print_pp __P((DB_ENV *, u_int32_t));
165 * PUBLIC: #endif
166 */
167int
168__repmgr_stat_print_pp(dbenv, flags)
169	DB_ENV *dbenv;
170	u_int32_t flags;
171{
172	COMPQUIET(flags, 0);
173	return (__db_norepmgr(dbenv));
174}
175
176/*
177 * PUBLIC: #ifndef HAVE_REPLICATION_THREADS
178 * PUBLIC: int __repmgr_handle_event __P((ENV *, u_int32_t, void *));
179 * PUBLIC: #endif
180 */
181int
182__repmgr_handle_event(env, event, info)
183	ENV *env;
184	u_int32_t event;
185	void *info;
186{
187	COMPQUIET(env, NULL);
188	COMPQUIET(event, 0);
189	COMPQUIET(info, NULL);
190
191	/*
192	 * It's not an error for this function to be called.  Replication calls
193	 * this to let repmgr handle events.  If repmgr isn't part of the build,
194	 * all replication events should be forwarded to the application.
195	 */
196	return (DB_EVENT_NOT_HANDLED);
197}
198#endif /* !HAVE_REPLICATION_THREADS */
199