8000 Make raftable able to be started dynamically. · m99coder/postgres_cluster@8a87698 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a87698

Browse files
committed
Make raftable able to be started dynamically.
1 parent d20a473 commit 8a87698

File tree

13 files changed

+372
-702
lines changed

13 files changed

+372
-702
lines changed

contrib/raftable/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MODULE_big = raftable
2-
OBJS = raftable.o worker.o client.o state.o blockmem.o timeout.o raft/obj/raft.o raft/obj/util.o
2+
OBJS = raftable.o worker.o client.o state.o timeout.o raft/obj/raft.o raft/obj/util.o
33
EXTENSION = raftable
44
DATA = raftable--1.0.sql
55

contrib/raftable/blockmem.c

Lines changed: 0 additions & 166 deletions
This file was deleted.

contrib/raftable/blockmem.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

contrib/raftable/raftable--1.0.sql

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
22
\echo Use "CREATE EXTENSION raftable" to load this file. \quit
33

4-
-- get_local
5-
CREATE FUNCTION raftable(key varchar(64))
6-
RETURNS text
7-
AS 'MODULE_PATHNAME','raftable_sql_get_local'
8-
LANGUAGE C;
9-
104
-- get
115
CREATE FUNCTION raftable(key varchar(64), timeout_ms int)
126
RETURNS text
@@ -15,12 +9,24 @@ LANGUAGE C;
159

1610
-- set
1711
CREATE FUNCTION raftable(key varchar(64), value text, timeout_ms int)
18-
RETURNS void
12+
RETURNS bool
1913
AS 'MODULE_PATHNAME','raftable_sql_set'
2014
LANGUAGE C;
2115

22-
-- list
23-
CREATE FUNCTION raftable()
24-
RETURNS table (key varchar(64), value text)
25-
AS 'MODULE_PATHNAME','raftable_sql_list'
16+
-- configure the peer with the specified id
17+
CREATE FUNCTION raftable_peer(id int, host text, port int)
18+
RETURNS void
19+
AS 'MODULE_PATHNAME','raftable_sql_peer'
20+
LANGUAGE C;
21+
22+
-- start the worker as the peer with the specified id, returns pid of the started worker
23+
CREATE FUNCTION raftable_start(id int)
24+
RETURNS int
25+
AS 'MODULE_PATHNAME','raftable_sql_start'
26+
LANGUAGE C;
27+
28+
-- stop the worker
29+
CREATE FUNCTION raftable_stop()
30+
RETURNS void
31+
AS 'MODULE_PATHNAME','raftable_sql_stop'
2632
LANGUAGE C;

0 commit comments

Comments
 (0)
0