1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef _WLC_H
10#define _WLC_H
11
12#include "gdk.h"
13#include <time.h>
14#include "mal_exception.h"
15#include "mal_interpreter.h"
16
17/* #define _WLC_DEBUG_ */
18
19#define WLC_QUERY 1
20#define WLC_UPDATE 2
21#define WLC_CATALOG 3
22#define WLC_IGNORE 4
23
24/* WLC modes */
25#define WLC_STARTUP 0 // wlc not yet initialized
26#define WLC_RUN 1 // started for the current snapshot
27#define WLC_STOP 2 // finished last log file for this snapsho
28#define WLC_CLONE 3 // logs used in replica construction
29
30/*
31 * returns 1 if the file exists
32 */
33#ifndef F_OK
34#define F_OK 0
35#endif
36#ifdef _MSC_VER
37#define access(f, m) _access(f, m)
38#endif
39
40mal_export MT_Lock wlc_lock;
41mal_export char wlc_dir[FILENAME_MAX];
42mal_export lng wlc_id;
43mal_export int wlc_batches;
44mal_export int wlc_state;
45mal_export lng wlc_tag;
46mal_export int wlc_beat;
47mal_export char wlc_write[26];
48
49mal_export str WLCinit(void);
50mal_export int WLCused(void);
51mal_export void WLCreset(void);
52mal_export str WLCgetConfig(void);
53mal_export str WLCreadConfig(FILE *fd);
54mal_export str WLCflush(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
55mal_export str WLCinitCmd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
56mal_export str WLCmaster(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
57mal_export str WLCstop(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
58mal_export str WLCsetbeat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
59mal_export str WLCgetbeat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
60mal_export str WLCgetclock(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
61mal_export str WLCgettick(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
62mal_export str WLCtransaction(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
63mal_export str WLCquery(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
64mal_export str WLCcatalog(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
65mal_export str WLCaction(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
66mal_export str WLCfinish(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
67mal_export str WLCgeneric(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
68mal_export str WLCappend(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
69mal_export str WLCdelete(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
70mal_export str WLCupdate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
71mal_export str WLCclear_table(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
72mal_export str WLCcommit(int clientid);
73mal_export str WLCcommitCmd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
74mal_export str WLCrollback(int clientid);
75mal_export str WLCrollbackCmd(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
76#endif /* _WLC_H */
77