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