isomorfeus-ferret 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +612 -0
  3. data/README.md +44 -0
  4. data/ext/isomorfeus_ferret_ext/benchmark.c +223 -0
  5. data/ext/isomorfeus_ferret_ext/benchmark.h +45 -0
  6. data/ext/isomorfeus_ferret_ext/benchmarks_all.h +25 -0
  7. data/ext/isomorfeus_ferret_ext/bm_bitvector.c +123 -0
  8. data/ext/isomorfeus_ferret_ext/bm_hash.c +118 -0
  9. data/ext/isomorfeus_ferret_ext/bm_micro_string.c +40 -0
  10. data/ext/isomorfeus_ferret_ext/bm_store.c +93 -0
  11. data/ext/isomorfeus_ferret_ext/email.rl +21 -0
  12. data/ext/isomorfeus_ferret_ext/extconf.rb +5 -0
  13. data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -0
  14. data/ext/isomorfeus_ferret_ext/frb_analysis.c +2577 -0
  15. data/ext/isomorfeus_ferret_ext/frb_index.c +3457 -0
  16. data/ext/isomorfeus_ferret_ext/frb_lang.c +9 -0
  17. data/ext/isomorfeus_ferret_ext/frb_lang.h +17 -0
  18. data/ext/isomorfeus_ferret_ext/frb_qparser.c +629 -0
  19. data/ext/isomorfeus_ferret_ext/frb_search.c +4460 -0
  20. data/ext/isomorfeus_ferret_ext/frb_store.c +515 -0
  21. data/ext/isomorfeus_ferret_ext/frb_threading.h +30 -0
  22. data/ext/isomorfeus_ferret_ext/frb_utils.c +1127 -0
  23. data/ext/isomorfeus_ferret_ext/frt_analysis.c +1644 -0
  24. data/ext/isomorfeus_ferret_ext/frt_analysis.h +247 -0
  25. data/ext/isomorfeus_ferret_ext/frt_array.c +124 -0
  26. data/ext/isomorfeus_ferret_ext/frt_array.h +54 -0
  27. data/ext/isomorfeus_ferret_ext/frt_bitvector.c +95 -0
  28. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +586 -0
  29. data/ext/isomorfeus_ferret_ext/frt_compound_io.c +374 -0
  30. data/ext/isomorfeus_ferret_ext/frt_config.h +44 -0
  31. data/ext/isomorfeus_ferret_ext/frt_document.c +134 -0
  32. data/ext/isomorfeus_ferret_ext/frt_document.h +52 -0
  33. data/ext/isomorfeus_ferret_ext/frt_except.c +95 -0
  34. data/ext/isomorfeus_ferret_ext/frt_except.h +188 -0
  35. data/ext/isomorfeus_ferret_ext/frt_field_index.c +233 -0
  36. data/ext/isomorfeus_ferret_ext/frt_field_index.h +42 -0
  37. data/ext/isomorfeus_ferret_ext/frt_filter.c +157 -0
  38. data/ext/isomorfeus_ferret_ext/frt_fs_store.c +502 -0
  39. data/ext/isomorfeus_ferret_ext/frt_global.c +427 -0
  40. data/ext/isomorfeus_ferret_ext/frt_global.h +290 -0
  41. data/ext/isomorfeus_ferret_ext/frt_hash.c +518 -0
  42. data/ext/isomorfeus_ferret_ext/frt_hash.h +466 -0
  43. data/ext/isomorfeus_ferret_ext/frt_hashset.c +191 -0
  44. data/ext/isomorfeus_ferret_ext/frt_hashset.h +206 -0
  45. data/ext/isomorfeus_ferret_ext/frt_helper.c +62 -0
  46. data/ext/isomorfeus_ferret_ext/frt_helper.h +13 -0
  47. data/ext/isomorfeus_ferret_ext/frt_ind.c +353 -0
  48. data/ext/isomorfeus_ferret_ext/frt_ind.h +54 -0
  49. data/ext/isomorfeus_ferret_ext/frt_index.c +6377 -0
  50. data/ext/isomorfeus_ferret_ext/frt_index.h +880 -0
  51. data/ext/isomorfeus_ferret_ext/frt_lang.c +104 -0
  52. data/ext/isomorfeus_ferret_ext/frt_lang.h +44 -0
  53. data/ext/isomorfeus_ferret_ext/frt_mempool.c +87 -0
  54. data/ext/isomorfeus_ferret_ext/frt_mempool.h +33 -0
  55. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +349 -0
  56. data/ext/isomorfeus_ferret_ext/frt_multimapper.h +52 -0
  57. data/ext/isomorfeus_ferret_ext/frt_posh.c +1006 -0
  58. data/ext/isomorfeus_ferret_ext/frt_posh.h +973 -0
  59. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +147 -0
  60. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +147 -0
  61. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +1612 -0
  62. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +157 -0
  63. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +209 -0
  64. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +281 -0
  65. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +147 -0
  66. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +672 -0
  67. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +3084 -0
  68. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +1182 -0
  69. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +98 -0
  70. data/ext/isomorfeus_ferret_ext/frt_q_range.c +665 -0
  71. data/ext/isomorfeus_ferret_ext/frt_q_span.c +2386 -0
  72. data/ext/isomorfeus_ferret_ext/frt_q_term.c +311 -0
  73. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +166 -0
  74. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +460 -0
  75. data/ext/isomorfeus_ferret_ext/frt_scanner.c +899 -0
  76. data/ext/isomorfeus_ferret_ext/frt_scanner.h +28 -0
  77. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +6705 -0
  78. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +4419 -0
  79. data/ext/isomorfeus_ferret_ext/frt_search.c +1824 -0
  80. data/ext/isomorfeus_ferret_ext/frt_search.h +924 -0
  81. data/ext/isomorfeus_ferret_ext/frt_similarity.c +150 -0
  82. data/ext/isomorfeus_ferret_ext/frt_similarity.h +79 -0
  83. data/ext/isomorfeus_ferret_ext/frt_sort.c +796 -0
  84. data/ext/isomorfeus_ferret_ext/frt_stopwords.c +395 -0
  85. data/ext/isomorfeus_ferret_ext/frt_store.c +680 -0
  86. data/ext/isomorfeus_ferret_ext/frt_store.h +789 -0
  87. data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +72 -0
  88. data/ext/isomorfeus_ferret_ext/frt_threading.h +23 -0
  89. data/ext/isomorfeus_ferret_ext/frt_win32.h +54 -0
  90. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +409 -0
  91. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +95 -0
  92. data/ext/isomorfeus_ferret_ext/libstemmer.c +93 -0
  93. data/ext/isomorfeus_ferret_ext/libstemmer.h +73 -0
  94. data/ext/isomorfeus_ferret_ext/q_parser.y +1366 -0
  95. data/ext/isomorfeus_ferret_ext/scanner.h +28 -0
  96. data/ext/isomorfeus_ferret_ext/scanner.in +43 -0
  97. data/ext/isomorfeus_ferret_ext/scanner.rl +84 -0
  98. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +200 -0
  99. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +85 -0
  100. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +324 -0
  101. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +7 -0
  102. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +610 -0
  103. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +6 -0
  104. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +1104 -0
  105. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +6 -0
  106. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +749 -0
  107. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +7 -0
  108. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +1233 -0
  109. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +6 -0
  110. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +490 -0
  111. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +6 -0
  112. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +1217 -0
  113. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +7 -0
  114. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +1052 -0
  115. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +6 -0
  116. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +283 -0
  117. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +6 -0
  118. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +735 -0
  119. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +6 -0
  120. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +1003 -0
  121. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +7 -0
  122. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +1079 -0
  123. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +6 -0
  124. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +293 -0
  125. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +6 -0
  126. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +984 -0
  127. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +6 -0
  128. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +686 -0
  129. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +6 -0
  130. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.c +325 -0
  131. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.h +6 -0
  132. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.c +620 -0
  133. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.h +6 -0
  134. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.c +1111 -0
  135. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.h +6 -0
  136. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.c +754 -0
  137. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.h +6 -0
  138. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.c +1242 -0
  139. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.h +6 -0
  140. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.c +495 -0
  141. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.h +6 -0
  142. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.c +1220 -0
  143. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.h +6 -0
  144. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.c +1059 -0
  145. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.h +6 -0
  146. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.c +285 -0
  147. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.h +6 -0
  148. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.c +741 -0
  149. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.h +6 -0
  150. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.c +1009 -0
  151. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.h +6 -0
  152. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.c +990 -0
  153. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.h +6 -0
  154. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.c +680 -0
  155. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.h +6 -0
  156. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.c +1083 -0
  157. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.h +6 -0
  158. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.c +294 -0
  159. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.h +6 -0
  160. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.c +2191 -0
  161. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.h +6 -0
  162. data/ext/isomorfeus_ferret_ext/stem_api.c +66 -0
  163. data/ext/isomorfeus_ferret_ext/stem_api.h +26 -0
  164. data/ext/isomorfeus_ferret_ext/stem_header.h +57 -0
  165. data/ext/isomorfeus_ferret_ext/stem_modules.h +190 -0
  166. data/ext/isomorfeus_ferret_ext/stem_modules.txt +50 -0
  167. data/ext/isomorfeus_ferret_ext/stem_utilities.c +478 -0
  168. data/ext/isomorfeus_ferret_ext/test.c +850 -0
  169. data/ext/isomorfeus_ferret_ext/test.h +416 -0
  170. data/ext/isomorfeus_ferret_ext/test_1710.c +63 -0
  171. data/ext/isomorfeus_ferret_ext/test_analysis.c +1221 -0
  172. data/ext/isomorfeus_ferret_ext/test_array.c +272 -0
  173. data/ext/isomorfeus_ferret_ext/test_bitvector.c +600 -0
  174. data/ext/isomorfeus_ferret_ext/test_compound_io.c +170 -0
  175. data/ext/isomorfeus_ferret_ext/test_document.c +156 -0
  176. data/ext/isomorfeus_ferret_ext/test_except.c +244 -0
  177. data/ext/isomorfeus_ferret_ext/test_fields.c +522 -0
  178. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +185 -0
  179. data/ext/isomorfeus_ferret_ext/test_filter.c +331 -0
  180. data/ext/isomorfeus_ferret_ext/test_fs_store.c +25 -0
  181. data/ext/isomorfeus_ferret_ext/test_global.c +299 -0
  182. data/ext/isomorfeus_ferret_ext/test_hash.c +485 -0
  183. data/ext/isomorfeus_ferret_ext/test_hashset.c +288 -0
  184. data/ext/isomorfeus_ferret_ext/test_helper.c +47 -0
  185. data/ext/isomorfeus_ferret_ext/test_highlighter.c +548 -0
  186. data/ext/isomorfeus_ferret_ext/test_index.c +2323 -0
  187. data/ext/isomorfeus_ferret_ext/test_lang.c +74 -0
  188. data/ext/isomorfeus_ferret_ext/test_mempool.c +102 -0
  189. data/ext/isomorfeus_ferret_ext/test_multimapper.c +64 -0
  190. data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +213 -0
  191. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +84 -0
  192. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +61 -0
  193. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +241 -0
  194. data/ext/isomorfeus_ferret_ext/test_q_parser.c +464 -0
  195. data/ext/isomorfeus_ferret_ext/test_q_span.c +575 -0
  196. data/ext/isomorfeus_ferret_ext/test_ram_store.c +77 -0
  197. data/ext/isomorfeus_ferret_ext/test_search.c +1874 -0
  198. data/ext/isomorfeus_ferret_ext/test_segments.c +167 -0
  199. data/ext/isomorfeus_ferret_ext/test_similarity.c +25 -0
  200. data/ext/isomorfeus_ferret_ext/test_sort.c +333 -0
  201. data/ext/isomorfeus_ferret_ext/test_store.c +591 -0
  202. data/ext/isomorfeus_ferret_ext/test_store.h +3 -0
  203. data/ext/isomorfeus_ferret_ext/test_term.c +351 -0
  204. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +373 -0
  205. data/ext/isomorfeus_ferret_ext/test_test.c +83 -0
  206. data/ext/isomorfeus_ferret_ext/test_threading.c +188 -0
  207. data/ext/isomorfeus_ferret_ext/testhelper.c +561 -0
  208. data/ext/isomorfeus_ferret_ext/testhelper.h +25 -0
  209. data/ext/isomorfeus_ferret_ext/tests_all.h +87 -0
  210. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +1854 -0
  211. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +1999 -0
  212. data/ext/isomorfeus_ferret_ext/url.rl +27 -0
  213. data/ext/isomorfeus_ferret_ext/word_list.h +15156 -0
  214. data/lib/isomorfeus/ferret/document.rb +132 -0
  215. data/lib/isomorfeus/ferret/field_symbol.rb +85 -0
  216. data/lib/isomorfeus/ferret/index/field_infos.rb +48 -0
  217. data/lib/isomorfeus/ferret/index/index.rb +970 -0
  218. data/lib/isomorfeus/ferret/monitor.rb +323 -0
  219. data/lib/isomorfeus/ferret/stdlib_patches.rb +151 -0
  220. data/lib/isomorfeus/ferret/version.rb +5 -0
  221. data/lib/isomorfeus-ferret.rb +8 -0
  222. metadata +307 -0
@@ -0,0 +1,789 @@
1
+ #ifndef FRT_STORE_H
2
+ #define FRT_STORE_H
3
+
4
+ #include <sys/types.h>
5
+ #include "frt_global.h"
6
+ #include "frt_hash.h"
7
+ #include "frt_hashset.h"
8
+ #include "frb_threading.h"
9
+
10
+ #define FRT_LOCK_PREFIX "ferret-"
11
+ #define FRT_LOCK_EXT ".lck"
12
+
13
+ typedef struct FrtBuffer
14
+ {
15
+ frt_uchar buf[FRT_BUFFER_SIZE];
16
+ off_t start;
17
+ off_t pos;
18
+ off_t len;
19
+ } FrtBuffer;
20
+
21
+ typedef struct FrtOutStream FrtOutStream;
22
+ struct FrtOutStreamMethods {
23
+ /* internal functions for the FrtInStream */
24
+ /**
25
+ * Flush +len+ characters from +src+ to the output stream +os+
26
+ *
27
+ * @param os self
28
+ * @param src the characters to write to the output stream
29
+ * @param len the number of characters to write
30
+ * @raise FRT_IO_ERROR if there is an error writing the characters
31
+ */
32
+ void (*flush_i)(struct FrtOutStream *os, const frt_uchar *buf, int len);
33
+
34
+ /**
35
+ * Seek +pos+ in the output stream
36
+ *
37
+ * @param os self
38
+ * @param pos the position to seek in the stream
39
+ * @raise FRT_IO_ERROR if there is an error seeking in the output stream
40
+ */
41
+ void (*seek_i)(struct FrtOutStream *os, off_t pos);
42
+
43
+ /**
44
+ * Close any resources used by the output stream +os+
45
+ *
46
+ * @param os self
47
+ * @raise FRT_IO_ERROR if there is an closing the file
48
+ */
49
+ void (*close_i)(struct FrtOutStream *os);
50
+ };
51
+
52
+ typedef struct FrtRAMFile
53
+ {
54
+ char *name;
55
+ frt_uchar **buffers;
56
+ int bufcnt;
57
+ off_t len;
58
+ int ref_cnt;
59
+ } FrtRAMFile;
60
+
61
+ struct FrtOutStream
62
+ {
63
+ FrtBuffer buf;
64
+ union
65
+ {
66
+ int fd;
67
+ FrtRAMFile *rf;
68
+ } file;
69
+ off_t pointer; /* only used by RAMOut */
70
+ const struct FrtOutStreamMethods *m;
71
+ };
72
+
73
+ typedef struct FrtCompoundInStream FrtCompoundInStream;
74
+
75
+ typedef struct FrtInStream FrtInStream;
76
+
77
+ struct FrtInStreamMethods
78
+ {
79
+ /**
80
+ * Read +len+ characters from the input stream into the +offset+ position in
81
+ * +buf+, an array of unsigned characters.
82
+ *
83
+ * @param is self
84
+ * @param buf an array of characters which must be allocated with at least
85
+ * +offset+ + +len+ bytes
86
+ * @param len the number of bytes to read
87
+ * @raise FRT_IO_ERROR if there is an error reading from the input stream
88
+ */
89
+ void (*read_i)(struct FrtInStream *is, frt_uchar *buf, int len);
90
+
91
+ /**
92
+ * Seek position +pos+ in input stream +is+
93
+ *
94
+ * @param is self
95
+ * @param pos the position to seek
96
+ * @raise FRT_IO_ERROR if the seek fails
97
+ */
98
+ void (*seek_i)(struct FrtInStream *is, off_t pos);
99
+
100
+ /**
101
+ * Returns the length of the input stream +is+
102
+ *
103
+ * @param is self
104
+ * @raise FRT_IO_ERROR if there is an error getting the file length
105
+ */
106
+ off_t (*length_i)(struct FrtInStream *is);
107
+
108
+ /**
109
+ * Close the resources allocated to the inputstream +is+
110
+ *
111
+ * @param is self
112
+ * @raise FRT_IO_ERROR if the close fails
113
+ */
114
+ void (*close_i)(struct FrtInStream *is);
115
+ };
116
+
117
+ struct FrtInStream
118
+ {
119
+ FrtBuffer buf;
120
+ union
121
+ {
122
+ int fd;
123
+ FrtRAMFile *rf;
124
+ } file;
125
+ union
126
+ {
127
+ off_t pointer; /* only used by RAMIn */
128
+ char *path; /* only used by FSIn */
129
+ FrtCompoundInStream *cis;
130
+ } d;
131
+ int *ref_cnt_ptr;
132
+ const struct FrtInStreamMethods *m;
133
+ };
134
+
135
+ struct FrtCompoundInStream
136
+ {
137
+ FrtInStream *sub;
138
+ off_t offset;
139
+ off_t length;
140
+ };
141
+
142
+ #define frt_is_length(mis) mis->m->length_i(mis)
143
+
144
+ typedef struct FrtStore FrtStore;
145
+ typedef struct FrtLock FrtLock;
146
+ struct FrtLock
147
+ {
148
+ char *name;
149
+ FrtStore *store;
150
+ int (*obtain)(FrtLock *lock);
151
+ int (*is_locked)(FrtLock *lock);
152
+ void (*release)(FrtLock *lock);
153
+ };
154
+
155
+ typedef struct FrtCompoundStore
156
+ {
157
+ FrtStore *store;
158
+ const char *name;
159
+ FrtHash *entries;
160
+ FrtInStream *stream;
161
+ } FrtCompoundStore;
162
+
163
+ struct FrtStore
164
+ {
165
+ int ref_cnt; /* for fs_store only */
166
+ frt_mutex_t mutex_i; /* for internal use only */
167
+ frt_mutex_t mutex; /* external mutex for use outside */
168
+ union
169
+ {
170
+ char *path; /* for fs_store only */
171
+ FrtHash *ht; /* for ram_store only */
172
+ FrtCompoundStore *cmpd; /* for compound_store only */
173
+ } dir;
174
+
175
+ #if defined POSH_OS_WIN32 || defined POSH_OS_WIN64
176
+ int file_mode;
177
+ #else
178
+ mode_t file_mode;
179
+ #endif
180
+ FrtHashSet *locks;
181
+
182
+ /**
183
+ * Create the file +filename+ in the +store+.
184
+ *
185
+ * @param store self
186
+ * @param filename the name of the file to create
187
+ * @raise FRT_IO_ERROR if the file cannot be created
188
+ */
189
+ void (*touch)(FrtStore *store, const char *filename);
190
+
191
+ /**
192
+ * Return true if a file of name +filename+ exists in +store+.
193
+ *
194
+ * @param store self
195
+ * @param filename the name of the file to check for
196
+ * @returns true if the file exists
197
+ * @raise FRT_IO_ERROR if there is an error checking for the files existance
198
+ */
199
+ int (*exists)(FrtStore *store, const char *filename);
200
+
201
+ /**
202
+ * Remove the file +filename+ from the +store+
203
+ *
204
+ * @param store self
205
+ * @param filename the name of the file to remove
206
+ * @returns On success, zero is returned. On error, -1 is returned, and errno
207
+ * is set appropriately.
208
+ */
209
+ int (*remove)(FrtStore *store, const char *filename);
210
+
211
+ /**
212
+ * Rename the file in the +store+ from the name +from+ to the name +to+.
213
+ *
214
+ * @param store self
215
+ * @param from the name of the file to rename
216
+ * @param to the new name of the file
217
+ * @raise FRT_IO_ERROR if there is an error renaming the file
218
+ */
219
+ void (*rename)(FrtStore *store, const char *from, const char *to);
220
+
221
+ /**
222
+ * Returns the number of files in the store.
223
+ *
224
+ * @param store self
225
+ * @return the number of files in the store
226
+ * @raise FRT_IO_ERROR if there is an error opening the directory
227
+ */
228
+ int (*count)(FrtStore *store);
229
+
230
+ /**
231
+ * Call the function +func+ with each filename in the store and the arg
232
+ * that you passed. If you need to open the file you should pass the store
233
+ * as the argument. If you need to pass more than one argument, you should
234
+ * pass a struct.
235
+ *
236
+ * @param store self
237
+ * @param func the function to call with each files name and the +arg+
238
+ * passed
239
+ * @param arg the argument to pass to the function
240
+ * @raise FRT_IO_ERROR if there is an error opening the directory
241
+ */
242
+ void (*each)(FrtStore *store, void (*func)(const char *fname, void *arg),
243
+ void *arg);
244
+
245
+ /**
246
+ * Clear all the locks in the store.
247
+ *
248
+ * @param store self
249
+ * @raise FRT_IO_ERROR if there is an error opening the directory
250
+ */
251
+ void (*clear_locks)(FrtStore *store);
252
+
253
+ /**
254
+ * Clear all files from the store except the lock files.
255
+ *
256
+ * @param store self
257
+ * @raise FRT_IO_ERROR if there is an error deleting the files
258
+ */
259
+ void (*clear)(FrtStore *store);
260
+
261
+ /**
262
+ * Clear all files from the store including the lock files.
263
+ *
264
+ * @param store self
265
+ * @raise FRT_IO_ERROR if there is an error deleting the files
266
+ */
267
+ void (*clear_all)(FrtStore *store);
268
+
269
+ /**
270
+ * Return the length of the file +filename+ in +store+
271
+ *
272
+ * @param store self
273
+ * @param the name of the file to check the length of
274
+ * @return the length of the file in bytes
275
+ * @raise FRT_IO_ERROR if there is an error checking the file length
276
+ */
277
+ off_t (*length)(FrtStore *store, const char *filename);
278
+
279
+ /**
280
+ * Allocate the resources needed for the output stream in the +store+ with
281
+ * the name +filename+
282
+ *
283
+ * @param store self
284
+ * @param filename the name of the output stream
285
+ * @return a newly allocated filestream
286
+ * @raise FRT_IO_ERROR if there is an error opening the output stream
287
+ * resources
288
+ */
289
+ FrtOutStream *(*new_output)(FrtStore *store, const char *filename);
290
+
291
+ /**
292
+ * Open an input stream in the +store+ with the name +filename+
293
+ *
294
+ * @param store self
295
+ * @param filename the name of the input stream
296
+ * @raise FRT_FILE_NOT_FOUND_ERROR if the input stream cannot be opened
297
+ */
298
+ FrtInStream *(*open_input)(FrtStore *store, const char *filename);
299
+
300
+ /**
301
+ * Obtain a lock on the lock +lock+
302
+ *
303
+ * @param store self
304
+ * @param lock the lock to obtain
305
+ */
306
+ FrtLock *(*open_lock_i)(FrtStore *store, const char *lockname);
307
+
308
+ /**
309
+ * Returns true if +lock+ is locked. To test if the file is locked:wq
310
+ *
311
+ * @param lock the lock to test
312
+ * @raise FRT_IO_ERROR if there is an error detecting the lock status
313
+ */
314
+ void (*close_lock_i)(FrtLock *lock);
315
+
316
+ /**
317
+ * Internal function to close the store freeing implementation specific
318
+ * resources.
319
+ *
320
+ * @param store self
321
+ */
322
+ void (*close_i)(FrtStore *store);
323
+ };
324
+
325
+ /**
326
+ * Create a newly allocated file-system FrtStore at the pathname designated. The
327
+ * pathname must be the name of an existing directory.
328
+ *
329
+ * @param pathname the pathname of the directory to be used by the index
330
+ * @return a newly allocated file-system FrtStore.
331
+ */
332
+ extern FrtStore *frt_open_fs_store(const char *pathname);
333
+
334
+ /**
335
+ * Create a newly allocated in-memory or RAM FrtStore.
336
+ *
337
+ * @return a newly allocated RAM FrtStore.
338
+ */
339
+ extern FrtStore *frt_open_ram_store();
340
+
341
+ /**
342
+ * Create a newly allocated in-memory or RAM FrtStore. Copy the contents of
343
+ * another store into this store. Then close the other store if required. This
344
+ * method would be used for example to read an index into memory for faster
345
+ * searching.
346
+ *
347
+ * @param store the whose contents will be copied into the newly allocated RAM
348
+ * store
349
+ * @param close_store close the store whose contents where copied
350
+ * @return a newly allocated RAM FrtStore.
351
+ */
352
+ extern FrtStore *frt_open_ram_store_and_copy(FrtStore *store, bool close_store);
353
+
354
+ /**
355
+ * Open a compound store. This is basically store which is stored within a
356
+ * single file and can in turn be stored within either a FileSystem or RAM
357
+ * store.
358
+ *
359
+ * @param store the store within which this compound store will be stored
360
+ * @param filename the name of the file in which to store the compound store
361
+ * @return a newly allocated Compound FrtStore.
362
+ */
363
+ extern FrtStore *frt_open_cmpd_store(FrtStore *store, const char *filename);
364
+
365
+ /*
366
+ * == RamStore functions ==
367
+ *
368
+ * These functions or optimizations to be used when you know you are using a
369
+ * Ram FrtOutStream.
370
+ */
371
+
372
+ /**
373
+ * Reset the FrtOutStream removing any data written to it. Since it is a RAM
374
+ * file, all that needs to be done is set the length to 0.
375
+ *
376
+ * @param os the FrtOutStream to reset
377
+ */
378
+ extern void frt_ramo_reset(FrtOutStream *os);
379
+
380
+ /**
381
+ * Write the contents of a RAM FrtOutStream to another FrtOutStream.
382
+ *
383
+ * @param from_os the FrtOutStream to write from
384
+ * @param to_os the FrtOutStream to write to
385
+ */
386
+ extern void frt_ramo_write_to(FrtOutStream *from_os, FrtOutStream *to_os);
387
+
388
+ /**
389
+ * Create a buffer RAM FrtOutStream which is unassociated with any RAM FrtStore.
390
+ * This FrtOutStream can be used to write temporary data too. When the time
391
+ * comes, this data can be written to another FrtOutStream (which might possibly
392
+ * be a file-system FrtOutStream) using frt_ramo_write_to.
393
+ *
394
+ * @return A newly allocated RAM FrtOutStream
395
+ */
396
+ extern FrtOutStream *frt_ram_new_buffer();
397
+
398
+ /**
399
+ * Destroy a RAM FrtOutStream which is unassociated with any RAM FrtStore, freeing
400
+ * all resources allocated to it.
401
+ *
402
+ * @param os the FrtOutStream to destroy
403
+ */
404
+ extern void frt_ram_destroy_buffer(FrtOutStream *os);
405
+
406
+ /**
407
+ * Call the function +func+ with the +lock+ locked. The argument +arg+ will be
408
+ * passed to +func+. If you need to pass more than one argument you should use
409
+ * a struct. When the function is finished, release the lock.
410
+ *
411
+ * @param lock lock to be locked while func is called
412
+ * @param func function to call with the lock locked
413
+ * @param arg argument to pass to the function
414
+ * @raise FRT_IO_ERROR if the lock is already locked
415
+ * @see frt_with_lock_name
416
+ */
417
+ extern void frt_with_lock(FrtLock *lock, void (*func)(void *arg), void *arg);
418
+
419
+ /**
420
+ * Create a lock in the +store+ with the name +lock_name+. Call the function
421
+ * +func+ with the lock locked. The argument +arg+ will be passed to +func+.
422
+ * If you need to pass more than one argument you should use a struct. When
423
+ * the function is finished, release and destroy the lock.
424
+ *
425
+ * @param store store to open the lock in
426
+ * @param lock_name name of the lock to open
427
+ * @param func function to call with the lock locked
428
+ * @param arg argument to pass to the function
429
+ * @raise FRT_IO_ERROR if the lock is already locked
430
+ * @see frt_with_lock
431
+ */
432
+ extern void frt_with_lock_name(FrtStore *store, const char *lock_name, void (*func)(void *arg), void *arg);
433
+
434
+ /**
435
+ * Remove a reference to the store. If the reference count gets to zero free
436
+ * all resources used by the store.
437
+ *
438
+ * @param store the store to be dereferenced
439
+ */
440
+ extern void frt_store_deref(FrtStore *store);
441
+
442
+ /**
443
+ * Flush the buffered contents of the FrtOutStream to the store.
444
+ *
445
+ * @param os the FrtOutStream to flush
446
+ */
447
+ extern void frt_os_flush(FrtOutStream *os);
448
+
449
+ /**
450
+ * Close the FrtOutStream after flushing the buffers, also freeing all allocated
451
+ * resources.
452
+ *
453
+ * @param os the FrtOutStream to close
454
+ */
455
+ extern void frt_os_close(FrtOutStream *os);
456
+
457
+ /**
458
+ * Return the current position of FrtOutStream +os+.
459
+ *
460
+ * @param os the FrtOutStream to get the position from
461
+ * @return the current position in FrtOutStream +os+
462
+ */
463
+ extern off_t frt_os_pos(FrtOutStream *os);
464
+
465
+ /**
466
+ * Set the current position in FrtOutStream +os+.
467
+ *
468
+ * @param os the FrtOutStream to set the position in
469
+ * @param pos the new position in the FrtOutStream
470
+ * @raise FRT_IO_ERROR if there is a file-system IO error seeking the file
471
+ */
472
+ extern void frt_os_seek(FrtOutStream *os, off_t new_pos);
473
+
474
+ /**
475
+ * Write a single byte +b+ to the FrtOutStream +os+
476
+ *
477
+ * @param os the FrtOutStream to write to @param b the byte to write @raise
478
+ * FRT_IO_ERROR if there is an IO error writing to the file-system
479
+ */
480
+ extern void frt_os_write_byte(FrtOutStream *os, frt_uchar b);
481
+ /**
482
+ * Write +len+ bytes from buffer +buf+ to the FrtOutStream +os+.
483
+ *
484
+ * @param os the FrtOutStream to write to
485
+ * @param len the number of bytes to write
486
+ * @param buf the buffer from which to get the bytes to write.
487
+ * @raise FRT_IO_ERROR if there is an IO error writing to the file-system
488
+ */
489
+ extern void frt_os_write_bytes(FrtOutStream *os, const frt_uchar *buf, int len);
490
+
491
+ /**
492
+ * Write a 32-bit signed integer to the FrtOutStream
493
+ *
494
+ * @param os FrtOutStream to write to
495
+ * @param num the 32-bit signed integer to write
496
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
497
+ */
498
+ extern void frt_os_write_i32(FrtOutStream *os, frt_i32 num);
499
+
500
+ /**
501
+ * Write a 64-bit signed integer to the FrtOutStream
502
+ *
503
+ *
504
+ * @param os FrtOutStream to write to
505
+ * @param num the 64-bit signed integer to write
506
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
507
+ */
508
+ extern void frt_os_write_i64(FrtOutStream *os, frt_i64 num);
509
+
510
+ /**
511
+ * Write a 32-bit unsigned integer to the FrtOutStream
512
+ *
513
+ * @param os FrtOutStream to write to
514
+ * @param num the 32-bit unsigned integer to write
515
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
516
+ */
517
+ extern void frt_os_write_u32(FrtOutStream *os, frt_u32 num);
518
+
519
+ /**
520
+ * Write a 64-bit unsigned integer to the FrtOutStream
521
+ *
522
+ * @param os FrtOutStream to write to
523
+ * @param num the 64-bit unsigned integer to write
524
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
525
+ */
526
+ extern void frt_os_write_u64(FrtOutStream *os, frt_u64 num);
527
+
528
+ /**
529
+ * Write an unsigned integer to FrtOutStream in compressed VINT format.
530
+ * TODO: describe VINT format
531
+ *
532
+ * @param os FrtOutStream to write to
533
+ * @param num the integer to write
534
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
535
+ */
536
+ extern void frt_os_write_vint(FrtOutStream *os, register unsigned int num);
537
+
538
+ /**
539
+ * Write an unsigned off_t to FrtOutStream in compressed VINT format.
540
+ * TODO: describe VINT format
541
+ *
542
+ * @param os FrtOutStream to write to
543
+ * @param num the off_t to write
544
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
545
+ */
546
+ extern void frt_os_write_voff_t(FrtOutStream *os, register off_t num);
547
+
548
+ /**
549
+ * Write an unsigned 64bit int to FrtOutStream in compressed VINT format.
550
+ * TODO: describe VINT format
551
+ *
552
+ * @param os FrtOutStream to write to
553
+ * @param num the 64bit int to write
554
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
555
+ */
556
+ extern void frt_os_write_vll(FrtOutStream *os, register frt_u64 num);
557
+
558
+ /**
559
+ * Write a string with known length to the FrtOutStream. A string is an
560
+ * integer +length+ in VINT format (see frt_os_write_vint) followed by
561
+ * +length+ bytes. The string can then be read using frt_is_read_string.
562
+ *
563
+ * @param os FrtOutStream to write to
564
+ * @param str the string to write
565
+ * @param len the length of the string to write
566
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
567
+ */
568
+ extern void frt_os_write_string_len(FrtOutStream *os,
569
+ const char *str,
570
+ int len);
571
+
572
+ /**
573
+ * Write a string to the FrtOutStream. A string is an integer +length+ in VINT
574
+ * format (see frt_os_write_vint) followed by +length+ bytes. The string can then
575
+ * be read using frt_is_read_string.
576
+ *
577
+ * @param os FrtOutStream to write to
578
+ * @param str the string to write
579
+ * @raise FRT_IO_ERROR if there is an error writing to the file-system
580
+ */
581
+ extern void frt_os_write_string(FrtOutStream *os, const char *str);
582
+
583
+ /**
584
+ * Get the current position within an FrtInStream.
585
+ *
586
+ * @param is the FrtInStream to get the current position from
587
+ * @return the current position within the FrtInStream +is+
588
+ */
589
+ extern off_t frt_is_pos(FrtInStream *is);
590
+
591
+ /**
592
+ * Set the current position in FrtInStream +is+ to +pos+.
593
+ *
594
+ * @param is the FrtInStream to set the current position in
595
+ * @param pos the position in FrtInStream to seek
596
+ * @raise FRT_IO_ERROR if there is a error seeking from the file-system
597
+ * @raise FRT_EOF_ERROR if there is an attempt to seek past the end of the file
598
+ */
599
+ extern void frt_is_seek(FrtInStream *is, off_t pos);
600
+
601
+ /**
602
+ * Close the FrtInStream freeing all allocated resources.
603
+ *
604
+ * @param is the FrtInStream to close
605
+ * @raise FRT_IO_ERROR if there is an error closing the associated file
606
+ */
607
+ extern void frt_is_close(FrtInStream *is);
608
+
609
+ /**
610
+ * Clone the FrtInStream allocating a new FrtInStream structure
611
+ *
612
+ * @param is the FrtInStream to clone
613
+ * @return a newly allocated FrtInStream which is a clone of +is+
614
+ */
615
+ extern FrtInStream *frt_is_clone(FrtInStream *is);
616
+
617
+ /**
618
+ * Read a singly byte (unsigned char) from the FrtInStream +is+.
619
+ *
620
+ * @param is the Instream to read from
621
+ * @return a single unsigned char read from the FrtInStream +is+
622
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
623
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
624
+ */
625
+ extern frt_uchar frt_is_read_byte(FrtInStream *is);
626
+
627
+ /**
628
+ * Read +len+ bytes from FrtInStream +is+ and write them to buffer +buf+
629
+ *
630
+ * @param is the FrtInStream to read from
631
+ * @param buf the buffer to read into, that is copy the bytes read to
632
+ * @param len the number of bytes to read
633
+ * @return the resultant buffer +buf+
634
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
635
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
636
+ */
637
+ extern frt_uchar *frt_is_read_bytes(FrtInStream *is, frt_uchar *buf, int len);
638
+
639
+ /**
640
+ * Read a 32-bit unsigned integer from the FrtInStream.
641
+ *
642
+ * @param is the FrtInStream to read from
643
+ * @return a 32-bit unsigned integer
644
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
645
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
646
+ */
647
+ extern frt_i32 frt_is_read_i32(FrtInStream *is);
648
+
649
+ /**
650
+ * Read a 64-bit unsigned integer from the FrtInStream.
651
+ *
652
+ * @param is the FrtInStream to read from
653
+ * @return a 64-bit unsigned integer
654
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
655
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
656
+ */
657
+ extern frt_i64 frt_is_read_i64(FrtInStream *is);
658
+
659
+ /**
660
+ * Read a 32-bit signed integer from the FrtInStream.
661
+ *
662
+ * @param is the FrtInStream to read from
663
+ * @return a 32-bit signed integer
664
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
665
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
666
+ */
667
+ extern frt_u32 frt_is_read_u32(FrtInStream *is);
668
+
669
+ /**
670
+ * Read a 64-bit signed integer from the FrtInStream.
671
+ *
672
+ * @param is the FrtInStream to read from
673
+ * @return a 64-bit signed integer
674
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
675
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
676
+ */
677
+ extern frt_u64 frt_is_read_u64(FrtInStream *is);
678
+
679
+ /**
680
+ * Read a compressed (VINT) unsigned integer from the FrtInStream.
681
+ * TODO: describe VINT format
682
+ *
683
+ * @param is the FrtInStream to read from
684
+ * @return an int
685
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
686
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
687
+ */
688
+ extern unsigned int frt_is_read_vint(FrtInStream *is);
689
+
690
+ /**
691
+ * Skip _cnt_ vints. This is a convenience method used for performance reasons
692
+ * to skip large numbers of vints. It is mostly used by TermDocEnums. When
693
+ * skipping positions os the proximity index file.
694
+ *
695
+ * @param is the FrtInStream to read from
696
+ * @param cnt the number of vints to skip
697
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
698
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
699
+ */
700
+ extern void frt_is_skip_vints(FrtInStream *is, register int cnt);
701
+
702
+ /**
703
+ * Read a compressed (VINT) unsigned off_t from the FrtInStream.
704
+ * TODO: describe VINT format
705
+ *
706
+ * @param is the FrtInStream to read from
707
+ * @return a off_t
708
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
709
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
710
+ */
711
+ extern off_t frt_is_read_voff_t(FrtInStream *is);
712
+
713
+ /**
714
+ * Read a compressed (VINT) unsigned 64bit int from the FrtInStream.
715
+ * TODO: describe VINT format
716
+ *
717
+ * @param is the FrtInStream to read from
718
+ * @return a 64bit int
719
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
720
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
721
+ */
722
+ extern frt_u64 frt_is_read_vll(FrtInStream *is);
723
+
724
+ /**
725
+ * Read a string from the FrtInStream. A string is an integer +length+ in vint
726
+ * format (see frt_is_read_vint) followed by +length+ bytes. This is the format
727
+ * used by frt_os_write_string.
728
+ *
729
+ * @param is the FrtInStream to read from
730
+ * @return a null byte delimited string
731
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
732
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
733
+ */
734
+ extern char *frt_is_read_string(FrtInStream *is);
735
+
736
+ /**
737
+ * Read a string from the FrtInStream. A string is an integer +length+ in vint
738
+ * format (see frt_is_read_vint) followed by +length+ bytes. This is the format
739
+ * used by frt_os_write_string. This method is similar to +frt_is_read_string+ except
740
+ * that it will safely free all memory if there is an error reading the
741
+ * string.
742
+ *
743
+ * @param is the FrtInStream to read from
744
+ * @return a null byte delimited string
745
+ * @raise FRT_IO_ERROR if there is a error reading from the file-system
746
+ * @raise FRT_EOF_ERROR if there is an attempt to read past the end of the file
747
+ */
748
+ extern char *frt_is_read_string_safe(FrtInStream *is);
749
+
750
+ /**
751
+ * Copy cnt bytes from Instream _is_ to FrtOutStream _os_.
752
+ *
753
+ * @param is the FrtInStream to read from
754
+ * @param os the FrtOutStream to write to
755
+ * @raise FRT_IO_ERROR
756
+ * @raise FRT_EOF_ERROR
757
+ */
758
+ extern void frt_is2os_copy_bytes(FrtInStream *is, FrtOutStream *os, int cnt);
759
+
760
+ /**
761
+ * Copy cnt vints from Instream _is_ to FrtOutStream _os_.
762
+ *
763
+ * @param is the FrtInStream to read from
764
+ * @param os the FrtOutStream to write to
765
+ * @raise FRT_IO_ERROR
766
+ * @raise FRT_EOF_ERROR
767
+ */
768
+ extern void frt_is2os_copy_vints(FrtInStream *is, FrtOutStream *os, int cnt);
769
+
770
+ /**
771
+ * Print the filenames in a store to a buffer.
772
+ *
773
+ * @param store the store to get the filenames from
774
+ */
775
+ extern char *frt_store_to_s(FrtStore *store);
776
+
777
+ extern FrtLock *frt_open_lock(FrtStore *store, const char *lockname);
778
+ extern void frt_close_lock(FrtLock *lock);
779
+
780
+ /* required by submodules
781
+ * FIXME document. Perhaps include in different header?? */
782
+ extern FrtStore *frt_store_new();
783
+ extern void frt_store_destroy(FrtStore *store);
784
+ extern FrtOutStream *frt_os_new();
785
+ extern FrtInStream *frt_is_new();
786
+ extern int frt_file_is_lock(const char *filename);
787
+ extern bool frt_file_name_filter_is_index_file(const char *file_name, bool include_locks);
788
+
789
+ #endif