]> gitweb.factorcode.org Git - factor.git/blob - extra/tokyo/alien/tcbdb/tcbdb.factor
Remove ENUM: f and replace uses with CONSTANTs.
[factor.git] / extra / tokyo / alien / tcbdb / tcbdb.factor
1 ! Copyright (C) 2009 Bruno Deferrari
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.libraries alien.syntax
4 combinators kernel tokyo.alien.tchdb tokyo.alien.tcutil ;
5 IN: tokyo.alien.tcbdb
6
7 LIBRARY: tokyocabinet
8
9 TYPEDEF: void* TCBDB
10
11 CONSTANT: BDBFOPEN HDBFOPEN
12 CONSTANT: BDBFFATAL HDBFFATAL
13
14 CONSTANT: BDBTLARGE   1
15 CONSTANT: BDBTDEFLATE 2
16 CONSTANT: BDBTBZIP    4
17 CONSTANT: BDBTTCBS    8
18 CONSTANT: BDBTEXCODEC 16
19
20 CONSTANT: BDBOREADER 1
21 CONSTANT: BDBOWRITER 2
22 CONSTANT: BDBOCREAT  4
23 CONSTANT: BDBOTRUNC  8
24 CONSTANT: BDBONOLCK  16
25 CONSTANT: BDBOLCKNB  32
26 CONSTANT: BDBOTSYNC  64
27
28 TYPEDEF: void* BDBCUR
29
30 CONSTANT: BDBCPCURRENT 0
31 CONSTANT: BDBCPBEFORE 1
32 CONSTANT: BDBCPAFTER 2
33
34 FUNCTION: c-string tcbdberrmsg ( int ecode ) ;
35 FUNCTION: TCBDB* tcbdbnew ( ) ;
36 FUNCTION: void tcbdbdel ( TCBDB* bdb ) ;
37 FUNCTION: int tcbdbecode ( TCBDB* bdb ) ;
38 FUNCTION: bool tcbdbsetmutex ( TCBDB* bdb ) ;
39 FUNCTION: bool tcbdbsetcmpfunc ( TCBDB* bdb, TCCMP cmp, void* cmpop ) ;
40 FUNCTION: bool tcbdbtune ( TCBDB* bdb, int lmemb, int nmemb, longlong bnum, char apow, char fpow, uchar opts ) ;
41 FUNCTION: bool tcbdbsetcache ( TCBDB* bdb, int lcnum, int ncnum ) ;
42 FUNCTION: bool tcbdbsetxmsiz ( TCBDB* bdb, longlong xmsiz ) ;
43 FUNCTION: bool tcbdbopen ( TCBDB* bdb, c-string path, int omode ) ;
44 FUNCTION: bool tcbdbclose ( TCBDB* bdb ) ;
45 FUNCTION: bool tcbdbput ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
46 FUNCTION: bool tcbdbput2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
47 FUNCTION: bool tcbdbputkeep ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
48 FUNCTION: bool tcbdbputkeep2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
49 FUNCTION: bool tcbdbputcat ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
50 FUNCTION: bool tcbdbputcat2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
51 FUNCTION: bool tcbdbputdup ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
52 FUNCTION: bool tcbdbputdup2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
53 FUNCTION: bool tcbdbputdup3 ( TCBDB* bdb, void* kbuf, int ksiz, TCLIST* vals ) ;
54 FUNCTION: bool tcbdbout ( TCBDB* bdb, void* kbuf, int ksiz ) ;
55 FUNCTION: bool tcbdbout2 ( TCBDB* bdb, c-string kstr ) ;
56 FUNCTION: bool tcbdbout3 ( TCBDB* bdb, void* kbuf, int ksiz ) ;
57 FUNCTION: void* tcbdbget ( TCBDB* bdb, void* kbuf, int ksiz, int* sp ) ;
58 FUNCTION: c-string tcbdbget2 ( TCBDB* bdb, c-string kstr ) ;
59 FUNCTION: void* tcbdbget3 ( TCBDB* bdb, void* kbuf, int ksiz, int* sp ) ;
60 FUNCTION: TCLIST* tcbdbget4 ( TCBDB* bdb, void* kbuf, int ksiz ) ;
61 FUNCTION: int tcbdbvnum ( TCBDB* bdb, void* kbuf, int ksiz ) ;
62 FUNCTION: int tcbdbvnum2 ( TCBDB* bdb, c-string kstr ) ;
63 FUNCTION: int tcbdbvsiz ( TCBDB* bdb, void* kbuf, int ksiz ) ;
64 FUNCTION: int tcbdbvsiz2 ( TCBDB* bdb, c-string kstr ) ;
65 FUNCTION: TCLIST* tcbdbrange ( TCBDB* bdb, void* bkbuf, int bksiz, bool binc, void* ekbuf, int eksiz, bool einc, int max ) ;
66 FUNCTION: TCLIST* tcbdbrange2 ( TCBDB* bdb, c-string bkstr, bool binc, c-string ekstr, bool einc, int max ) ;
67 FUNCTION: TCLIST* tcbdbfwmkeys ( TCBDB* bdb, void* pbuf, int psiz, int max ) ;
68 FUNCTION: TCLIST* tcbdbfwmkeys2 ( TCBDB* bdb, c-string pstr, int max ) ;
69 FUNCTION: int tcbdbaddint ( TCBDB* bdb, void* kbuf, int ksiz, int num ) ;
70 FUNCTION: double tcbdbadddouble ( TCBDB* bdb, void* kbuf, int ksiz, double num ) ;
71 FUNCTION: bool tcbdbsync ( TCBDB* bdb ) ;
72 FUNCTION: bool tcbdboptimize ( TCBDB* bdb, int lmemb, int nmemb, longlong bnum, char apow, char fpow, uchar opts ) ;
73 FUNCTION: bool tcbdbvanish ( TCBDB* bdb ) ;
74 FUNCTION: bool tcbdbcopy ( TCBDB* bdb, c-string path ) ;
75 FUNCTION: bool tcbdbtranbegin ( TCBDB* bdb ) ;
76 FUNCTION: bool tcbdbtrancommit ( TCBDB* bdb ) ;
77 FUNCTION: bool tcbdbtranabort ( TCBDB* bdb ) ;
78 FUNCTION: c-string tcbdbpath ( TCBDB* bdb ) ;
79 FUNCTION: ulonglong tcbdbrnum ( TCBDB* bdb ) ;
80 FUNCTION: ulonglong tcbdbfsiz ( TCBDB* bdb ) ;
81 FUNCTION: BDBCUR* tcbdbcurnew ( TCBDB* bdb ) ;
82 FUNCTION: void tcbdbcurdel ( BDBCUR* cur ) ;
83 FUNCTION: bool tcbdbcurfirst ( BDBCUR* cur ) ;
84 FUNCTION: bool tcbdbcurlast ( BDBCUR* cur ) ;
85 FUNCTION: bool tcbdbcurjump ( BDBCUR* cur, void* kbuf, int ksiz ) ;
86 FUNCTION: bool tcbdbcurjump2 ( BDBCUR* cur, c-string kstr ) ;
87 FUNCTION: bool tcbdbcurprev ( BDBCUR* cur ) ;
88 FUNCTION: bool tcbdbcurnext ( BDBCUR* cur ) ;
89 FUNCTION: bool tcbdbcurput ( BDBCUR* cur, void* vbuf, int vsiz, int cpmode ) ;
90 FUNCTION: bool tcbdbcurput2 ( BDBCUR* cur, c-string vstr, int cpmode ) ;
91 FUNCTION: bool tcbdbcurout ( BDBCUR* cur ) ;
92 FUNCTION: void* tcbdbcurkey ( BDBCUR* cur, int* sp ) ;
93 FUNCTION: c-string tcbdbcurkey2 ( BDBCUR* cur ) ;
94 FUNCTION: void* tcbdbcurkey3 ( BDBCUR* cur, int* sp ) ;
95 FUNCTION: void* tcbdbcurval ( BDBCUR* cur, int* sp ) ;
96 FUNCTION: c-string tcbdbcurval2 ( BDBCUR* cur ) ;
97 FUNCTION: void* tcbdbcurval3 ( BDBCUR* cur, int* sp ) ;
98 FUNCTION: bool tcbdbcurrec ( BDBCUR* cur, TCXSTR* kxstr, TCXSTR* vxstr ) ;
99
100 ! -----------
101
102 FUNCTION: void tcbdbsetecode ( TCBDB* bdb, int ecode, c-string filename, int line, c-string func ) ;
103 FUNCTION: void tcbdbsetdbgfd ( TCBDB* bdb, int fd ) ;
104 FUNCTION: int tcbdbdbgfd ( TCBDB* bdb ) ;
105 FUNCTION: bool tcbdbhasmutex ( TCBDB* bdb ) ;
106 FUNCTION: bool tcbdbmemsync ( TCBDB* bdb, bool phys ) ;
107 FUNCTION: bool tcbdbcacheclear ( TCBDB* bdb ) ;
108 FUNCTION: TCCMP tcbdbcmpfunc ( TCBDB* bdb ) ;
109 FUNCTION: void* tcbdbcmpop ( TCBDB* bdb ) ;
110 FUNCTION: uint tcbdblmemb ( TCBDB* bdb ) ;
111 FUNCTION: uint tcbdbnmemb ( TCBDB* bdb ) ;
112 FUNCTION: ulonglong tcbdblnum ( TCBDB* bdb ) ;
113 FUNCTION: ulonglong tcbdbnnum ( TCBDB* bdb ) ;
114 FUNCTION: ulonglong tcbdbbnum ( TCBDB* bdb ) ;
115 FUNCTION: uint tcbdbalign ( TCBDB* bdb ) ;
116 FUNCTION: uint tcbdbfbpmax ( TCBDB* bdb ) ;
117 FUNCTION: ulonglong tcbdbinode ( TCBDB* bdb ) ;
118 FUNCTION: tokyo_time_t tcbdbmtime ( TCBDB* bdb ) ;
119 FUNCTION: uchar tcbdbflags ( TCBDB* bdb ) ;
120 FUNCTION: uchar tcbdbopts ( TCBDB* bdb ) ;
121 FUNCTION: c-string tcbdbopaque ( TCBDB* bdb ) ;
122 FUNCTION: ulonglong tcbdbbnumused ( TCBDB* bdb ) ;
123 FUNCTION: bool tcbdbsetlsmax ( TCBDB* bdb, uint lsmax ) ;
124 FUNCTION: bool tcbdbsetcapnum ( TCBDB* bdb, ulonglong capnum ) ;
125 FUNCTION: bool tcbdbsetcodecfunc ( TCBDB* bdb, TCCODEC enc, void* encop, TCCODEC dec, void* decop ) ;
126 FUNCTION: bool tcbdbputdupback ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
127 FUNCTION: bool tcbdbputdupback2 ( TCBDB* bdb, c-string kstr, c-string vstr ) ;
128 FUNCTION: bool tcbdbputproc ( TCBDB* bdb, void* kbuf, int ksiz, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
129 FUNCTION: bool tcbdbcurjumpback ( BDBCUR* cur, void* kbuf, int ksiz ) ;
130 FUNCTION: bool tcbdbcurjumpback2 ( BDBCUR* cur, c-string kstr ) ;
131 FUNCTION: bool tcbdbforeach ( TCBDB* bdb, TCITER iter, void* op ) ;