-
Notifications
You must be signed in to change notification settings - Fork 6
/
scrext.h
96 lines (71 loc) · 3.95 KB
/
scrext.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*************************************************************************************************
* Scripting language extension of Tokyo Tyrant
* Copyright (C) 2006-2010 FAL Labs
* This file is part of Tokyo Tyrant.
* Tokyo Tyrant is free software; you can redistribute it and/or modify it under the terms of
* the GNU Lesser General Public License as published by the Free Software Foundation; either
* version 2.1 of the License or any later version. Tokyo Tyrant is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
* You should have received a copy of the GNU Lesser General Public License along with Tokyo
* Tyrant; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA.
*************************************************************************************************/
#ifndef _SCREXT_H // duplication check
#define _SCREXT_H
/*************************************************************************************************
* configuration
*************************************************************************************************/
#include "myconf.h"
#include <ttutil.h>
#include <tculog.h>
#include <tcrdb.h>
#if defined(_MYLUA)
#define TTLUAEXT
#else
#define TTNOEXT
#endif
/*************************************************************************************************
* pseudo API
*************************************************************************************************/
/* Initialize the scripting language extension.
`screxts' specifies an array of the scripting language extension objects.
`thnum' specifies the number of the native threads.
`thid' specifies the thread ID number.
`path' specifies the path of the initilizing script.
`adb' specifies the abstract database object.
`ulog' specifies the update log object.
`sid' specifies the server ID.
`stash' specifies the global stash object.
`lock' specifies the global lock object.
`logger' specifies the pointer to a function to do with a log message.
`logopq' specifies the opaque pointer for the logging function.
The return value is the scripting object or `NULL' on failure. */
void *scrextnew(void **screxts, int thnum, int thid, const char *path,
TCADB *adb, TCULOG *ulog, uint32_t sid, TCMDB *stash, TCMDB *lock,
void (*logger)(int, const char *, void *), void *logopq);
/* Destroy the scripting language extension.
`scr' specifies the scripting object.
If successful, the return value is true, else, it is false. */
bool scrextdel(void *scr);
/* Call a method of the scripting language extension.
`scr' specifies the scripting object.
`name' specifies the name of the method to be called.
`kbuf' specifies the pointer to the region of the key.
`ksiz' specifies the size of the region of the key.
`vbuf' specifies the pointer to the region of the value.
`vsiz' specifies the size of the region of the value.
`sp' specifies the pointer to the variable into which the size of the region of the return
value is assigned.
If successful, the return value is the pointer to the region of the value of the corresponding
record. It should be allocated by `malloc' call. `NULL' is returned on failure.
Note that the returned region is released by the caller. */
char *scrextcallmethod(void *scr, const char *name,
const void *kbuf, int ksiz, const void *vbuf, int vsiz, int *sp);
/* Send the terminate signal to the scripting language extension.
`scr' specifies the scripting object.
If successful, the return value is true, else, it is false. */
bool scrextkill(void *scr);
#endif // duplication check
// END OF FILE