1 |
dpavlin |
2 |
/************************************************************************************************* |
2 |
|
|
* IDL for bindings of scripting languages |
3 |
|
|
* Copyright (C) 2004-2005 Mikio Hirabayashi |
4 |
|
|
* This file is part of Hyper Estraier. |
5 |
|
|
* Hyper Estraier is free software; you can redistribute it and/or modify it under the terms of |
6 |
|
|
* the GNU Lesser General Public License as published by the Free Software Foundation; either |
7 |
|
|
* version 2.1 of the License or any later version. Hyper Estraier is distributed in the hope |
8 |
|
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
10 |
|
|
* License for more details. |
11 |
|
|
* You should have received a copy of the GNU Lesser General Public License along with Hyper |
12 |
|
|
* Estraier; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
13 |
|
|
* Boston, MA 02111-1307 USA. |
14 |
|
|
*************************************************************************************************/ |
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
/** |
19 |
|
|
* namespace of Hyper Estraier |
20 |
|
|
*/ |
21 |
|
|
module estraier { |
22 |
|
|
//---------------------------------------------------------------- |
23 |
|
|
// data structures for utility |
24 |
|
|
//---------------------------------------------------------------- |
25 |
|
|
/** |
26 |
dpavlin |
9 |
* List of strings (to be substituted for by the native list mechanism). |
27 |
dpavlin |
2 |
*/ |
28 |
|
|
interface List { |
29 |
|
|
string put(in string value); |
30 |
|
|
string get(in long index); |
31 |
|
|
}; |
32 |
|
|
/* |
33 |
dpavlin |
9 |
* Map of pairs of strings (to be substituted for by the native map mechanism). |
34 |
dpavlin |
2 |
*/ |
35 |
|
|
interface Map { |
36 |
|
|
string put(in string key, in string value); |
37 |
|
|
string get(in string key); |
38 |
|
|
}; |
39 |
|
|
//---------------------------------------------------------------- |
40 |
|
|
// core API |
41 |
|
|
//---------------------------------------------------------------- |
42 |
|
|
/** |
43 |
dpavlin |
9 |
* Abstraction of document. |
44 |
dpavlin |
2 |
*/ |
45 |
|
|
interface Document { |
46 |
|
|
void add_attr(in string name, in string value); |
47 |
|
|
void add_text(in string text); |
48 |
|
|
void add_hidden_text(in string text); |
49 |
|
|
long id(); |
50 |
|
|
List attr_names(); |
51 |
|
|
string attr(in string name); |
52 |
|
|
List texts(); |
53 |
|
|
string cat_texts(); |
54 |
|
|
string dump_draft(); |
55 |
|
|
string make_snippet(in List words, in long wwidth, in long hwidth, in long awidth); |
56 |
|
|
boolean scan_words(in List words); |
57 |
|
|
}; |
58 |
|
|
/** |
59 |
dpavlin |
9 |
* Abstraction of search condition. |
60 |
dpavlin |
2 |
*/ |
61 |
|
|
interface Condition { |
62 |
|
|
const long CONDSURE = 1 << 0; |
63 |
|
|
const long CONDUSU = 1 << 1; |
64 |
|
|
const long CONDFAST = 1 << 2; |
65 |
|
|
const long CONDAGIT = 1 << 3; |
66 |
|
|
const long CONDNOIDF = 1 << 4; |
67 |
|
|
const long CONDSIMPLE = 1 << 10; |
68 |
|
|
void set_phrase(in string phrase); |
69 |
|
|
void add_attr(in string expr); |
70 |
|
|
void set_order(in string expr); |
71 |
|
|
void set_max(in long max); |
72 |
|
|
void set_options(in long options); |
73 |
|
|
}; |
74 |
|
|
/** |
75 |
dpavlin |
9 |
* Abstraction of result set from database. |
76 |
dpavlin |
2 |
*/ |
77 |
dpavlin |
9 |
interface DatabaseResult { |
78 |
dpavlin |
2 |
long doc_num(); |
79 |
|
|
long get_doc_id(in long index); |
80 |
dpavlin |
9 |
string hint(in string key); |
81 |
dpavlin |
2 |
}; |
82 |
|
|
/** |
83 |
dpavlin |
9 |
* Abstraction of database. |
84 |
dpavlin |
2 |
*/ |
85 |
|
|
interface Database { |
86 |
|
|
const long ERRNOERR = 0; |
87 |
|
|
const long ERRINVAL = 1; |
88 |
|
|
const long ERRACCES = 2; |
89 |
|
|
const long ERRLOCK = 3; |
90 |
|
|
const long ERRDB = 4; |
91 |
|
|
const long ERRIO = 5; |
92 |
|
|
const long ERRNOITEM = 6; |
93 |
|
|
const long ERRMISC = 9999; |
94 |
|
|
const long DBREADER = 1 << 0; |
95 |
|
|
const long DBWRITER = 1 << 1; |
96 |
|
|
const long DBCREAT = 1 << 2; |
97 |
|
|
const long DBTRUNC = 1 << 3; |
98 |
|
|
const long DBNOLCK = 1 << 4; |
99 |
|
|
const long DBLCKNB = 1 << 5; |
100 |
|
|
const long DBPERFNG = 1 << 6; |
101 |
|
|
const long PDCLEAN = 1 << 0; |
102 |
|
|
const long ODCLEAN = 1 << 0; |
103 |
|
|
const long OPTNOPURGE = 1 << 0; |
104 |
|
|
const long OPTNODBOPT = 1 << 1; |
105 |
|
|
const long GDNOATTR = 1 << 0; |
106 |
|
|
const long GDNOTEXT = 1 << 1; |
107 |
|
|
string err_msg(in long ecode); |
108 |
|
|
boolean open(in string name, in long omode); |
109 |
|
|
boolean close(); |
110 |
|
|
long error(); |
111 |
|
|
boolean fatal(); |
112 |
|
|
boolean flush(in long max); |
113 |
|
|
boolean sync(); |
114 |
|
|
boolean optimize(in long options); |
115 |
|
|
boolean put_doc(in Document doc, in long options); |
116 |
|
|
boolean out_doc(in long id, in long options); |
117 |
|
|
Document get_doc(in long id, in long options); |
118 |
|
|
string get_doc_attr(in long id, in string name); |
119 |
|
|
long uri_to_id(in string uri); |
120 |
|
|
Map etch_doc(in Document doc, in long max); |
121 |
|
|
boolean iter_init(); |
122 |
|
|
long iter_next(); |
123 |
|
|
string name(); |
124 |
|
|
long doc_num(); |
125 |
|
|
long word_num(); |
126 |
|
|
double size(); |
127 |
dpavlin |
9 |
DatabaseResult search(in Condition cond); |
128 |
dpavlin |
2 |
void set_cache_size(in double size, in long anum, in long tnum); |
129 |
|
|
void set_special_cache(in string name, in long num); |
130 |
|
|
}; |
131 |
|
|
//---------------------------------------------------------------- |
132 |
|
|
// node API |
133 |
|
|
//---------------------------------------------------------------- |
134 |
|
|
/** |
135 |
dpavlin |
9 |
* Abstraction of document in result set. |
136 |
dpavlin |
2 |
*/ |
137 |
dpavlin |
9 |
interface ResultDocument { |
138 |
dpavlin |
2 |
string uri(); |
139 |
|
|
List attr_names(); |
140 |
|
|
string attr(in string name); |
141 |
|
|
string snippet(); |
142 |
|
|
}; |
143 |
|
|
/** |
144 |
dpavlin |
9 |
* Abstraction of result set from node. |
145 |
dpavlin |
2 |
*/ |
146 |
dpavlin |
9 |
interface NodeResult { |
147 |
dpavlin |
2 |
long doc_num(); |
148 |
dpavlin |
9 |
ResultDocument get_doc(in long index); |
149 |
|
|
string hint(in string key); |
150 |
dpavlin |
2 |
}; |
151 |
|
|
/** |
152 |
dpavlin |
9 |
* Abstraction of connection to P2P node. |
153 |
dpavlin |
2 |
*/ |
154 |
|
|
interface Node { |
155 |
dpavlin |
9 |
long status(); |
156 |
dpavlin |
2 |
void set_url(in string url); |
157 |
|
|
void set_proxy(in string host, in long port); |
158 |
|
|
void set_timeout(in long msec); |
159 |
|
|
void set_auth(in string name, in string password); |
160 |
|
|
boolean put_doc(in Document doc); |
161 |
|
|
boolean out_doc(in long id); |
162 |
dpavlin |
9 |
boolean out_doc_by_uri(in string uri); |
163 |
dpavlin |
2 |
Document get_doc(in long id); |
164 |
|
|
Document get_doc_by_uri(in string uri); |
165 |
|
|
string get_doc_attr(in long id, in string name); |
166 |
|
|
string get_doc_attr_by_uri(in string uri, in string name); |
167 |
|
|
long uri_to_id(in string uri); |
168 |
|
|
string name(); |
169 |
|
|
string label(); |
170 |
|
|
long doc_num(); |
171 |
|
|
long word_num(); |
172 |
|
|
double size(); |
173 |
dpavlin |
9 |
NodeResult search(in Condition cond, in long depth); |
174 |
dpavlin |
2 |
boolean set_user(in string name, in long mode); |
175 |
|
|
boolean set_link(in string url, in string label, in long credit); |
176 |
|
|
}; |
177 |
|
|
}; |
178 |
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
/* END OF FILE */ |