]> gitweb.factorcode.org Git - factor.git/blob - extra/tokyo/alien/tchdb/tchdb.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / tokyo / alien / tchdb / tchdb.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.tcutil ;
5 IN: tokyo.alien.tchdb
6
7 LIBRARY: tokyocabinet
8
9 TYPEDEF: void* TCHDB*
10
11 CONSTANT: HDBFOPEN  1
12 CONSTANT: HDBFFATAL 2
13
14 CONSTANT: HDBTLARGE   1
15 CONSTANT: HDBTDEFLATE 2
16 CONSTANT: HDBTBZIP    4
17 CONSTANT: HDBTTCBS    8
18 CONSTANT: HDBTEXCODEC 16
19
20 CONSTANT: HDBOREADER 1
21 CONSTANT: HDBOWRITER 2
22 CONSTANT: HDBOCREAT  4
23 CONSTANT: HDBOTRUNC  8
24 CONSTANT: HDBONOLCK  16
25 CONSTANT: HDBOLCKNB  32
26 CONSTANT: HDBOTSYNC  64
27
28 FUNCTION: char* tchdberrmsg ( int ecode ) ;
29 FUNCTION: TCHDB* tchdbnew ( ) ;
30 FUNCTION: void tchdbdel ( TCHDB* hdb ) ;
31 FUNCTION: int tchdbecode ( TCHDB* hdb ) ;
32 FUNCTION: bool tchdbsetmutex ( TCHDB* hdb ) ;
33 FUNCTION: bool tchdbtune ( TCHDB* hdb, longlong bnum, char apow, char fpow, uchar opts ) ;
34 FUNCTION: bool tchdbsetcache ( TCHDB* hdb, int rcnum ) ;
35 FUNCTION: bool tchdbsetxmsiz ( TCHDB* hdb, longlong xmsiz ) ;
36 FUNCTION: bool tchdbopen ( TCHDB* hdb, char* path, int omode ) ;
37 FUNCTION: bool tchdbclose ( TCHDB* hdb ) ;
38 FUNCTION: bool tchdbput ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
39 FUNCTION: bool tchdbput2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
40 FUNCTION: bool tchdbputkeep ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
41 FUNCTION: bool tchdbputkeep2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
42 FUNCTION: bool tchdbputcat ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
43 FUNCTION: bool tchdbputcat2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
44 FUNCTION: bool tchdbputasync ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ;
45 FUNCTION: bool tchdbputasync2 ( TCHDB* hdb, char* kstr, char* vstr ) ;
46 FUNCTION: bool tchdbout ( TCHDB* hdb, void* kbuf, int ksiz ) ;
47 FUNCTION: bool tchdbout2 ( TCHDB* hdb, char* kstr ) ;
48 FUNCTION: void* tchdbget ( TCHDB* hdb, void* kbuf, int ksiz, int* sp ) ;
49 FUNCTION: char* tchdbget2 ( TCHDB* hdb, char* kstr ) ;
50 FUNCTION: int tchdbget3 ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int max ) ;
51 FUNCTION: int tchdbvsiz ( TCHDB* hdb, void* kbuf, int ksiz ) ;
52 FUNCTION: int tchdbvsiz2 ( TCHDB* hdb, char* kstr ) ;
53 FUNCTION: bool tchdbiterinit ( TCHDB* hdb ) ;
54 FUNCTION: void* tchdbiternext ( TCHDB* hdb, int* sp ) ;
55 FUNCTION: char* tchdbiternext2 ( TCHDB* hdb ) ;
56 FUNCTION: bool tchdbiternext3 ( TCHDB* hdb, TCXSTR* kxstr, TCXSTR* vxstr ) ;
57 FUNCTION: TCLIST* tchdbfwmkeys ( TCHDB* hdb, void* pbuf, int psiz, int max ) ;
58 FUNCTION: TCLIST* tchdbfwmkeys2 ( TCHDB* hdb, char* pstr, int max ) ;
59 FUNCTION: int tchdbaddint ( TCHDB* hdb, void* kbuf, int ksiz, int num ) ;
60 FUNCTION: double tchdbadddouble ( TCHDB* hdb, void* kbuf, int ksiz, double num ) ;
61 FUNCTION: bool tchdbsync ( TCHDB* hdb ) ;
62 FUNCTION: bool tchdboptimize ( TCHDB* hdb, longlong bnum, char apow, char fpow, uchar opts ) ;
63 FUNCTION: bool tchdbvanish ( TCHDB* hdb ) ;
64 FUNCTION: bool tchdbcopy ( TCHDB* hdb, char* path ) ;
65 FUNCTION: bool tchdbtranbegin ( TCHDB* hdb ) ;
66 FUNCTION: bool tchdbtrancommit ( TCHDB* hdb ) ;
67 FUNCTION: bool tchdbtranabort ( TCHDB* hdb ) ;
68 FUNCTION: char* tchdbpath ( TCHDB* hdb ) ;
69 FUNCTION: ulonglong tchdbrnum ( TCHDB* hdb ) ;
70 FUNCTION: ulonglong tchdbfsiz ( TCHDB* hdb ) ;
71
72 ! --------
73
74 FUNCTION: void tchdbsetecode ( TCHDB* hdb, int ecode, char* filename, int line, char* func ) ;
75 FUNCTION: void tchdbsettype ( TCHDB* hdb, uchar type ) ;
76 FUNCTION: void tchdbsetdbgfd ( TCHDB* hdb, int fd ) ;
77 FUNCTION: int tchdbdbgfd ( TCHDB* hdb ) ;
78 FUNCTION: bool tchdbhasmutex ( TCHDB* hdb ) ;
79 FUNCTION: bool tchdbmemsync ( TCHDB* hdb, bool phys ) ;
80 FUNCTION: bool tchdbcacheclear ( TCHDB* hdb ) ;
81 FUNCTION: ulonglong tchdbbnum ( TCHDB* hdb ) ;
82 FUNCTION: uint tchdbalign ( TCHDB* hdb ) ;
83 FUNCTION: uint tchdbfbpmax ( TCHDB* hdb ) ;
84 FUNCTION: ulonglong tchdbxmsiz ( TCHDB* hdb ) ;
85 FUNCTION: ulonglong tchdbinode ( TCHDB* hdb ) ;
86 FUNCTION: tokyo_time_t tchdbmtime ( TCHDB* hdb ) ;
87 FUNCTION: int tchdbomode ( TCHDB* hdb ) ;
88 FUNCTION: uchar tchdbtype ( TCHDB* hdb ) ;
89 FUNCTION: uchar tchdbflags ( TCHDB* hdb ) ;
90 FUNCTION: uchar tchdbopts ( TCHDB* hdb ) ;
91 FUNCTION: char* tchdbopaque ( TCHDB* hdb ) ;
92 FUNCTION: ulonglong tchdbbnumused ( TCHDB* hdb ) ;
93 FUNCTION: bool tchdbsetcodecfunc ( TCHDB* hdb, TCCODEC enc, void* encop, TCCODEC dec, void* decop ) ;
94 FUNCTION: void tchdbcodecfunc ( TCHDB* hdb, TCCODEC* ep, void* *eop, TCCODEC* dp, void* *dop ) ;
95 FUNCTION: bool tchdbputproc ( TCHDB* hdb, void* kbuf, int ksiz, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ;
96 FUNCTION: void* tchdbgetnext ( TCHDB* hdb, void* kbuf, int ksiz, int* sp ) ;
97 FUNCTION: char* tchdbgetnext2 ( TCHDB* hdb, char* kstr ) ;
98 FUNCTION: char* tchdbgetnext3 ( TCHDB* hdb, char* kbuf, int ksiz, int* sp, char* *vbp, int* vsp ) ;
99 FUNCTION: bool tchdbforeach ( TCHDB* hdb, TCITER iter, void* op ) ;
100 FUNCTION: bool tchdbtranvoid ( TCHDB* hdb ) ;