23 |
// data structures for utility |
// data structures for utility |
24 |
//---------------------------------------------------------------- |
//---------------------------------------------------------------- |
25 |
/** |
/** |
26 |
* list of strings (to be substituted for by the native list mechanism) |
* List of strings (to be substituted for by the native list mechanism). |
27 |
*/ |
*/ |
28 |
interface List { |
interface List { |
29 |
string put(in string value); |
string put(in string value); |
30 |
string get(in long index); |
string get(in long index); |
31 |
}; |
}; |
32 |
/* |
/* |
33 |
* map of pairs of strings (to be substituted for by the native map mechanism) |
* Map of pairs of strings (to be substituted for by the native map mechanism). |
34 |
*/ |
*/ |
35 |
interface Map { |
interface Map { |
36 |
string put(in string key, in string value); |
string put(in string key, in string value); |
40 |
// core API |
// core API |
41 |
//---------------------------------------------------------------- |
//---------------------------------------------------------------- |
42 |
/** |
/** |
43 |
* abstraction of document |
* Abstraction of document. |
44 |
*/ |
*/ |
45 |
interface Document { |
interface Document { |
46 |
void add_attr(in string name, in string value); |
void add_attr(in string name, in string value); |
56 |
boolean scan_words(in List words); |
boolean scan_words(in List words); |
57 |
}; |
}; |
58 |
/** |
/** |
59 |
* abstraction of search condition |
* Abstraction of search condition. |
60 |
*/ |
*/ |
61 |
interface Condition { |
interface Condition { |
62 |
const long CONDSURE = 1 << 0; |
const long CONDSURE = 1 << 0; |
72 |
void set_options(in long options); |
void set_options(in long options); |
73 |
}; |
}; |
74 |
/** |
/** |
75 |
* abstraction of result set from database |
* Abstraction of result set from database. |
76 |
*/ |
*/ |
77 |
interface Database_result { |
interface DatabaseResult { |
78 |
long doc_num(); |
long doc_num(); |
79 |
long get_doc_id(in long index); |
long get_doc_id(in long index); |
80 |
Map hints(); |
string hint(in string key); |
81 |
}; |
}; |
82 |
/** |
/** |
83 |
* abstraction of database |
* Abstraction of database. |
84 |
*/ |
*/ |
85 |
interface Database { |
interface Database { |
86 |
const long ERRNOERR = 0; |
const long ERRNOERR = 0; |
124 |
long doc_num(); |
long doc_num(); |
125 |
long word_num(); |
long word_num(); |
126 |
double size(); |
double size(); |
127 |
Database_result search(in Condition cond); |
DatabaseResult search(in Condition cond); |
128 |
void set_cache_size(in double size, in long anum, in long tnum); |
void set_cache_size(in double size, in long anum, in long tnum); |
129 |
void set_special_cache(in string name, in long num); |
void set_special_cache(in string name, in long num); |
130 |
}; |
}; |
132 |
// node API |
// node API |
133 |
//---------------------------------------------------------------- |
//---------------------------------------------------------------- |
134 |
/** |
/** |
135 |
* abstraction of document in result |
* Abstraction of document in result set. |
136 |
*/ |
*/ |
137 |
interface Result_document { |
interface ResultDocument { |
138 |
string uri(); |
string uri(); |
139 |
List attr_names(); |
List attr_names(); |
140 |
string attr(in string name); |
string attr(in string name); |
141 |
string snippet(); |
string snippet(); |
142 |
}; |
}; |
143 |
/** |
/** |
144 |
* abstraction of result set from node |
* Abstraction of result set from node. |
145 |
*/ |
*/ |
146 |
interface Node_result { |
interface NodeResult { |
147 |
long doc_num(); |
long doc_num(); |
148 |
Result_document get_doc(in long index); |
ResultDocument get_doc(in long index); |
149 |
Map hints(); |
string hint(in string key); |
150 |
}; |
}; |
151 |
/** |
/** |
152 |
* abstraction of node |
* Abstraction of connection to P2P node. |
153 |
*/ |
*/ |
154 |
interface Node { |
interface Node { |
155 |
|
long status(); |
156 |
void set_url(in string url); |
void set_url(in string url); |
157 |
void set_proxy(in string host, in long port); |
void set_proxy(in string host, in long port); |
158 |
void set_timeout(in long msec); |
void set_timeout(in long msec); |
159 |
void set_auth(in string name, in string password); |
void set_auth(in string name, in string password); |
|
void add_header(in string name, in string value); |
|
160 |
boolean put_doc(in Document doc); |
boolean put_doc(in Document doc); |
161 |
boolean out_doc(in long id); |
boolean out_doc(in long id); |
162 |
|
boolean out_doc_by_uri(in string uri); |
163 |
Document get_doc(in long id); |
Document get_doc(in long id); |
164 |
Document get_doc_by_uri(in string uri); |
Document get_doc_by_uri(in string uri); |
165 |
string get_doc_attr(in long id, in string name); |
string get_doc_attr(in long id, in string name); |
170 |
long doc_num(); |
long doc_num(); |
171 |
long word_num(); |
long word_num(); |
172 |
double size(); |
double size(); |
173 |
Node_result search(in Condition cond, in long depth); |
NodeResult search(in Condition cond, in long depth); |
174 |
boolean set_user(in string name, in long mode); |
boolean set_user(in string name, in long mode); |
175 |
boolean set_link(in string url, in string label, in long credit); |
boolean set_link(in string url, in string label, in long credit); |
176 |
}; |
}; |