1 /* Copyright(C) 2006 Brazil
2      All rights reserved.
3      This is free software with ABSOLUTELY NO WARRANTY.
4 
5  You can redistribute it and/or modify it under the terms of
6  the GNU General Public License version 2.
7 */
8 
9 #include "senna.h"
10 
11 #ifndef _MYISENNA_H
12 #define _MYISENNA_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 enum myis_key_opt {
19   MYIS_KEY_EXACT = 0,
20   MYIS_KEY_OR_NEXT,
21   MYIS_KEY_OR_PREV,
22   MYIS_AFTER_KEY,
23   MYIS_BEFORE_KEY,
24   MYIS_PREFIX,
25   MYIS_PREFIX_LAST
26 };
27 
28 typedef unsigned long long myis_id;
29 typedef struct _myis_table myis_table;
30 typedef struct _myis_index myis_index;
31 typedef struct _myis_cursor myis_cursor;
32 typedef struct _myis_column myis_column;
33 
34 int myis_init(void);
35 myis_table *myis_table_open(const char *path);
36 int myis_table_close(myis_table *table);
37 int myis_table_info(myis_table *table, int *n_columns, int *n_indexes);
38 
39 myis_index *myis_table_index(myis_table *table, int n);
40 sen_index *myis_table_fti(myis_table *table, int n);
41 int myis_index_rkey(myis_index *index, myis_cursor *cursor,
42 		    const char *key, unsigned int key_len, enum myis_key_opt opt);
43 int myis_index_rfirst(myis_index *index, myis_cursor *cursor);
44 int myis_index_rlast(myis_index *index, myis_cursor *cursor);
45 const char *myis_index_name(myis_index *index);
46 
47 myis_cursor *myis_cursor_open(myis_table *table);
48 int myis_cursor_close(myis_cursor *cursor);
49 int myis_cursor_next(myis_cursor *cursor);
50 int myis_cursor_prev(myis_cursor *cursor);
51 int myis_cursor_scan_init(myis_cursor *cursor);
52 int myis_cursor_scan(myis_cursor *cursor);
53 int myis_cursor_rrnd(myis_cursor *cursor, myis_id id);
54 
55 myis_column *myis_table_column(myis_table *table, int n);
56 const char *myis_column_name(myis_column *column);
57 int myis_column_val_str(myis_column *column, myis_cursor *cursor,
58 			char *buf, size_t bufsize);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* _MYISENNA_H */
65