Skip to content

Commit d1a4564

Browse files
committed
Add missing C API implementations to raftable.
1 parent 535c5a2 commit d1a4564

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

contrib/raftable/raftable.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ static int get_connection(void)
140140
return leadersock;
141141
}
142142

143+
char *raftable_get(char *key)
144+
{
145+
return state_get(shared.state, key);
146+
}
147+
143148
Datum
144149
raftable_sql_get(PG_FUNCTION_ARGS)
145150
{
@@ -244,6 +249,21 @@ raftable_sql_set(PG_FUNCTION_ARGS)
244249
PG_RETURN_VOID();
245250
}
246251

252+
void raftable_every(void (*func)(char *, char *, void *), void *arg)
253+
{
254+
void *scan;
255+
char *key, *value;
256+
Assert(shared.state);
257+
258+
scan = state_scan(shared.state);
259+
while (state_next(shared.state, scan, &key, &value))
260+
{
261+
func(key, value, arg);
262+
pfree(key);
263+
pfree(value);
264+
}
265+
}
266+
247267
Datum
248268
raftable_sql_list(PG_FUNCTION_ARGS)
249269
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy