jk-ferret 0.11.8.2 → 0.11.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/ext/except.h +6 -1
- data/ext/ferret.c +5 -5
- data/ext/fs_store.c +20 -12
- data/ext/global.c +46 -6
- data/ext/global.h +13 -0
- data/ext/index.c +1 -1
- data/ext/internal.h +1 -0
- data/ext/q_phrase.c +5 -6
- data/ext/q_span.c +2 -1
- data/ext/r_index.c +10 -6
- data/ext/r_qparser.c +1 -1
- data/ext/r_search.c +4 -4
- data/ext/ram_store.c +2 -1
- data/ext/store.c +1 -1
- data/ext/store.h +5 -5
- data/lib/ferret/field_symbol.rb +1 -1
- data/lib/ferret/version.rb +1 -1
- data/test/unit/store/tc_fs_store.rb +1 -1
- data/test/unit/store/tm_store_lock.rb +6 -5
- metadata +9 -24
data/Rakefile
CHANGED
data/ext/except.h
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
*
|
4
4
|
* Exception Handling looks something like this;
|
5
5
|
*
|
6
|
+
* ### NOTE ###
|
7
|
+
* You must use a FINALLY block if you use "default:" block. Otherwise the
|
8
|
+
* default: block will get called in place of the FINALLY block.
|
9
|
+
*
|
10
|
+
*
|
6
11
|
* <pre>
|
7
12
|
* FRT_TRY
|
8
13
|
* FRT_RAISE(FRT_EXCEPTION, msg1);
|
@@ -143,7 +148,7 @@ typedef struct frt_xcontext_t
|
|
143
148
|
# define FRT_RAISE(excode, ...) do {\
|
144
149
|
snprintf(frt_xmsg_buffer, FRT_XMSG_BUFFER_SIZE, __VA_ARGS__);\
|
145
150
|
snprintf(frt_xmsg_buffer_final, FRT_XMSG_BUFFER_SIZE,\
|
146
|
-
"Error occured in %s:%d - %s\n\t%s
|
151
|
+
"Error occured in %s:%d - %s\n\t%s",\
|
147
152
|
__FILE__, __LINE__, __func__, frt_xmsg_buffer);\
|
148
153
|
frt_xraise(excode, frt_xmsg_buffer_final);\
|
149
154
|
} while (0)
|
data/ext/ferret.c
CHANGED
@@ -86,7 +86,7 @@ void
|
|
86
86
|
//object_del(void *key)
|
87
87
|
object_del2(void *key, const char *file, int line)
|
88
88
|
{
|
89
|
-
if (object_get(key) == Qnil)
|
89
|
+
if (object_get(key) == Qnil)
|
90
90
|
printf("failed deleting %ld. %s:%d\n", (long)key, file, line);
|
91
91
|
//printf("deleting %ld. now contains %ld, %s:%d\n", (long)key, --hash_cnt, file, line);
|
92
92
|
h_del(object_map, key);
|
@@ -140,7 +140,6 @@ void *frb_thread_getspecific(thread_key_t key)
|
|
140
140
|
void frb_create_dir(VALUE rpath)
|
141
141
|
{
|
142
142
|
VALUE mFileUtils;
|
143
|
-
rb_require("fileutils");
|
144
143
|
mFileUtils = rb_define_module("FileUtils");
|
145
144
|
rb_funcall(mFileUtils, id_mkdir_p, 1, rpath);
|
146
145
|
}
|
@@ -261,7 +260,7 @@ void V_FRT_EXIT(const char *err_type, const char *fmt, va_list args)
|
|
261
260
|
}
|
262
261
|
|
263
262
|
snprintf(buf + so_far, FRT_BUF_SIZ - so_far, "\n");
|
264
|
-
rb_raise(frb_get_error(err_type), buf);
|
263
|
+
rb_raise(frb_get_error(err_type), "%s", buf);
|
265
264
|
}
|
266
265
|
|
267
266
|
#ifdef FRT_HAS_VARARGS
|
@@ -300,8 +299,8 @@ VALUE frb_get_term(Symbol field, const char *text)
|
|
300
299
|
static VALUE frb_term_to_s(VALUE self)
|
301
300
|
{
|
302
301
|
VALUE rstr;
|
303
|
-
VALUE rfield = rb_funcall(self, id_field, 0);
|
304
|
-
VALUE rtext = rb_funcall(self, id_text, 0);
|
302
|
+
VALUE rfield = rb_funcall(self, id_field, 0);
|
303
|
+
VALUE rtext = rb_funcall(self, id_text, 0);
|
305
304
|
char *field = StringValuePtr(rfield);
|
306
305
|
char *text = StringValuePtr(rtext);
|
307
306
|
char *term_str = ALLOC_N(char,
|
@@ -338,6 +337,7 @@ void Init_Ferret(void)
|
|
338
337
|
{
|
339
338
|
mFerret = rb_define_module("Ferret");
|
340
339
|
Init_Term();
|
340
|
+
rb_require("fileutils");
|
341
341
|
}
|
342
342
|
|
343
343
|
void Init_ferret_ext(void)
|
data/ext/fs_store.c
CHANGED
@@ -153,6 +153,20 @@ static void fs_clear_locks(Store *store)
|
|
153
153
|
closedir(d);
|
154
154
|
}
|
155
155
|
|
156
|
+
static void remove_if_index_file(const char *base_path, const char *file_name)
|
157
|
+
{
|
158
|
+
char path[MAX_FILE_PATH];
|
159
|
+
char *basename;
|
160
|
+
join_path(path, base_path, file_name);
|
161
|
+
/* get basename of path */
|
162
|
+
basename = strrchr(path, DIR_SEPARATOR_CHAR);
|
163
|
+
basename = (basename ? basename + 1 : path);
|
164
|
+
/* we don't want to delete non-index files here */
|
165
|
+
if (file_name_filter_is_index_file(basename, true)) {
|
166
|
+
remove(path);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
156
170
|
static void fs_clear(Store *store)
|
157
171
|
{
|
158
172
|
struct dirent *de;
|
@@ -166,13 +180,16 @@ static void fs_clear(Store *store)
|
|
166
180
|
while ((de = readdir(d)) != NULL) {
|
167
181
|
if (de->d_name[0] > '/' /* skip ., .., / and '\0'*/
|
168
182
|
&& !file_is_lock(de->d_name)) {
|
169
|
-
|
170
|
-
remove(join_path(path, store->dir.path, de->d_name));
|
183
|
+
remove_if_index_file(store->dir.path, de->d_name);
|
171
184
|
}
|
172
185
|
}
|
173
186
|
closedir(d);
|
174
187
|
}
|
175
188
|
|
189
|
+
/**
|
190
|
+
* Clear all files which belong to the index. Use fs_clear to clear the
|
191
|
+
* directory regardless of the files origin.
|
192
|
+
*/
|
176
193
|
static void fs_clear_all(Store *store)
|
177
194
|
{
|
178
195
|
struct dirent *de;
|
@@ -185,16 +202,7 @@ static void fs_clear_all(Store *store)
|
|
185
202
|
|
186
203
|
while ((de = readdir(d)) != NULL) {
|
187
204
|
if (de->d_name[0] > '/') { /* skip ., .., / and '\0'*/
|
188
|
-
|
189
|
-
char *basename;
|
190
|
-
join_path(path, store->dir.path, de->d_name);
|
191
|
-
/* get basename of path */
|
192
|
-
basename = strrchr(path, DIR_SEPARATOR_CHAR);
|
193
|
-
basename = (basename ? basename + 1 : path);
|
194
|
-
/* we don't want to delete no index files here */
|
195
|
-
if (file_name_filter_is_index_file(basename, true)) {
|
196
|
-
remove(path);
|
197
|
-
}
|
205
|
+
remove_if_index_file(store->dir.path, de->d_name);
|
198
206
|
}
|
199
207
|
}
|
200
208
|
closedir(d);
|
data/ext/global.c
CHANGED
@@ -147,16 +147,14 @@ char *dbl_to_s(char *buf, double num)
|
|
147
147
|
}
|
148
148
|
#endif
|
149
149
|
|
150
|
-
sprintf(buf,
|
150
|
+
sprintf(buf, DBL2S, num);
|
151
151
|
if (!(e = strchr(buf, 'e'))) {
|
152
152
|
e = buf + strlen(buf);
|
153
153
|
}
|
154
154
|
if (!isdigit(e[-1])) {
|
155
155
|
/* reformat if ended with decimal point (ex 111111111111111.) */
|
156
156
|
sprintf(buf, "%#.6e", num);
|
157
|
-
if (!(e = strchr(buf, 'e'))) {
|
158
|
-
e = buf + strlen(buf);
|
159
|
-
}
|
157
|
+
if (!(e = strchr(buf, 'e'))) { e = buf + strlen(buf); }
|
160
158
|
}
|
161
159
|
p = e;
|
162
160
|
while (p[-1] == '0' && isdigit(p[-2])) {
|
@@ -275,8 +273,7 @@ static char *build_gdb_commandfile()
|
|
275
273
|
const char *commands = "bt\nquit\n";
|
276
274
|
char *filename = ALLOC_N(char, FILENAME_MAX);
|
277
275
|
int fd = build_tempfile(filename, FILENAME_MAX);
|
278
|
-
if (fd < 0)
|
279
|
-
return NULL;
|
276
|
+
if (fd < 0) { return NULL; }
|
280
277
|
write(fd, commands, strlen(commands));
|
281
278
|
close(fd);
|
282
279
|
return filename;
|
@@ -456,3 +453,46 @@ void init(int argc, const char *const argv[])
|
|
456
453
|
|
457
454
|
atexit(&hash_finalize);
|
458
455
|
}
|
456
|
+
|
457
|
+
/**
|
458
|
+
* For general use when testing
|
459
|
+
*
|
460
|
+
* TODO wrap in #ifdef
|
461
|
+
*/
|
462
|
+
|
463
|
+
static bool p_switch = false;
|
464
|
+
static bool p_switch_tmp = false;
|
465
|
+
|
466
|
+
void p(const char *format, ...)
|
467
|
+
{
|
468
|
+
va_list args;
|
469
|
+
|
470
|
+
if (!p_switch) return;
|
471
|
+
|
472
|
+
va_start(args, format);
|
473
|
+
vfprintf(stderr, format, args);
|
474
|
+
va_end(args);
|
475
|
+
}
|
476
|
+
|
477
|
+
void p_on()
|
478
|
+
{
|
479
|
+
fprintf(stderr, "> > > > > STARTING PRINT\n");
|
480
|
+
p_switch = true;
|
481
|
+
}
|
482
|
+
|
483
|
+
void p_off()
|
484
|
+
{
|
485
|
+
fprintf(stderr, "< < < < < STOPPING PRINT\n");
|
486
|
+
p_switch = false;
|
487
|
+
}
|
488
|
+
|
489
|
+
void p_pause()
|
490
|
+
{
|
491
|
+
p_switch_tmp = p_switch;
|
492
|
+
p_switch = false;
|
493
|
+
}
|
494
|
+
|
495
|
+
void p_resume()
|
496
|
+
{
|
497
|
+
p_switch = p_switch_tmp;
|
498
|
+
}
|
data/ext/global.h
CHANGED
@@ -18,6 +18,8 @@ extern "C" {
|
|
18
18
|
#define FRT_MAX_FILE_PATH 1024
|
19
19
|
#define FRT_BUFFER_SIZE 1024
|
20
20
|
|
21
|
+
#define FRT_DBL2S "%#.7g"
|
22
|
+
|
21
23
|
#if defined(__GNUC__) && !defined(__cplusplus)
|
22
24
|
# define FRT_INLINE
|
23
25
|
#else
|
@@ -299,4 +301,15 @@ extern void frt_clean_up();
|
|
299
301
|
} // extern "C"
|
300
302
|
#endif
|
301
303
|
|
304
|
+
|
305
|
+
/**
|
306
|
+
* For general use during testing. Switch this on and off for print statements
|
307
|
+
* to only print when p_on is called and not after p_off is called
|
308
|
+
*/
|
309
|
+
extern void p(const char *format, ...);
|
310
|
+
extern void p_on();
|
311
|
+
extern void p_off();
|
312
|
+
extern void p_pause();
|
313
|
+
extern void p_resume();
|
314
|
+
|
302
315
|
#endif
|
data/ext/index.c
CHANGED
data/ext/internal.h
CHANGED
@@ -24,6 +24,7 @@
|
|
24
24
|
#define COMMIT_LOCK_NAME FRT_COMMIT_LOCK_NAME
|
25
25
|
#define CONSTANT_QUERY FRT_CONSTANT_QUERY
|
26
26
|
#define CW_INIT_CAPA FRT_CW_INIT_CAPA
|
27
|
+
#define DBL2S FRT_DBL2S
|
27
28
|
#define DEFAULT_MAX_CLAUSE_COUNT FRT_DEFAULT_MAX_CLAUSE_COUNT
|
28
29
|
#define DEF_MAX_TERMS FRT_DEF_MAX_TERMS
|
29
30
|
#define DEF_MIN_SIM FRT_DEF_MIN_SIM
|
data/ext/q_phrase.c
CHANGED
@@ -52,6 +52,8 @@ typedef struct PhPos
|
|
52
52
|
static bool pp_next(PhPos *self)
|
53
53
|
{
|
54
54
|
TermDocEnum *tpe = self->tpe;
|
55
|
+
assert(tpe);
|
56
|
+
|
55
57
|
if (!tpe->next(tpe)) {
|
56
58
|
tpe->close(tpe); /* close stream */
|
57
59
|
self->tpe = NULL;
|
@@ -66,9 +68,7 @@ static bool pp_next(PhPos *self)
|
|
66
68
|
static bool pp_skip_to(PhPos *self, int doc_num)
|
67
69
|
{
|
68
70
|
TermDocEnum *tpe = self->tpe;
|
69
|
-
|
70
|
-
return false;
|
71
|
-
}
|
71
|
+
assert(tpe);
|
72
72
|
|
73
73
|
if (!tpe->skip_to(tpe, doc_num)) {
|
74
74
|
tpe->close(tpe); /* close stream */
|
@@ -337,11 +337,10 @@ static Scorer *phsc_new(Weight *weight,
|
|
337
337
|
for (j = 0; j < t_cnt; j++) {
|
338
338
|
if (hs_add(term_set, terms[j])) {
|
339
339
|
PhSc(self)->check_repeats = true;
|
340
|
-
|
340
|
+
break;
|
341
341
|
}
|
342
342
|
}
|
343
343
|
}
|
344
|
-
repeat_check_done:
|
345
344
|
PhSc(self)->phrase_pos[i] = pp_new(term_pos_enum[i], positions[i].pos);
|
346
345
|
}
|
347
346
|
|
@@ -1104,7 +1103,7 @@ static unsigned long phq_hash(Query *self)
|
|
1104
1103
|
char **terms = phq->positions[i].terms;
|
1105
1104
|
for (j = ary_size(terms) - 1; j >= 0; j--) {
|
1106
1105
|
hash = (hash << 1) ^ (str_hash(terms[j])
|
1107
|
-
|
1106
|
+
^ phq->positions[i].pos);
|
1108
1107
|
}
|
1109
1108
|
}
|
1110
1109
|
return (hash ^ phq->slop);
|
data/ext/q_span.c
CHANGED
@@ -828,7 +828,8 @@ static bool spanoe_skip_to(SpanEnum *self, int target)
|
|
828
828
|
}
|
829
829
|
else {
|
830
830
|
while ((soe->queue->size != 0) &&
|
831
|
-
((se = (SpanEnum *)pq_top(soe->queue))
|
831
|
+
((se = (SpanEnum *)pq_top(soe->queue)) != NULL) &&
|
832
|
+
(se->doc(se) < target)) {
|
832
833
|
if (se->skip_to(se, target)) {
|
833
834
|
pq_down(soe->queue);
|
834
835
|
}
|
data/ext/r_index.c
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#include "ferret.h"
|
2
2
|
#include "index.h"
|
3
|
-
#
|
3
|
+
#ifdef FRT_RUBY_VERSION_1_9
|
4
|
+
# include <ruby/st.h>
|
5
|
+
#else
|
6
|
+
# include <st.h>
|
7
|
+
#endif
|
4
8
|
|
5
9
|
VALUE mIndex;
|
6
10
|
|
@@ -811,7 +815,7 @@ frb_te_set_field(VALUE self, VALUE rfield)
|
|
811
815
|
} else {
|
812
816
|
Check_Type(rfield, T_SYMBOL);
|
813
817
|
rb_raise(rb_eArgError, "field %s doesn't exist in the index",
|
814
|
-
frb_field(rfield));
|
818
|
+
(char *)frb_field(rfield));
|
815
819
|
}
|
816
820
|
te->set_field(te, field_num);
|
817
821
|
|
@@ -940,7 +944,7 @@ frb_tde_seek(VALUE self, VALUE rfield, VALUE rterm)
|
|
940
944
|
field_num = FIX2INT(rfnum);
|
941
945
|
} else {
|
942
946
|
rb_raise(rb_eArgError, "field %s doesn't exist in the index",
|
943
|
-
frb_field(rfield));
|
947
|
+
(char *)frb_field(rfield));
|
944
948
|
}
|
945
949
|
tde->seek(tde, field_num, term);
|
946
950
|
return self;
|
@@ -2219,7 +2223,7 @@ frb_ir_get_norms_into(VALUE self, VALUE rfield, VALUE rnorms, VALUE roffset)
|
|
2219
2223
|
offset = FIX2INT(roffset);
|
2220
2224
|
Check_Type(rnorms, T_STRING);
|
2221
2225
|
if (RSTRING_LEN(rnorms) < offset + ir->max_doc(ir)) {
|
2222
|
-
rb_raise(rb_eArgError, "supplied a string of length:%
|
2226
|
+
rb_raise(rb_eArgError, "supplied a string of length:%ld to "
|
2223
2227
|
"IndexReader#get_norms_into but needed a string of length "
|
2224
2228
|
"offset:%d + maxdoc:%d",
|
2225
2229
|
RSTRING_LEN(rnorms), offset, ir->max_doc(ir));
|
@@ -2392,8 +2396,8 @@ frb_ir_get_doc(int argc, VALUE *argv, VALUE self)
|
|
2392
2396
|
pos = FIX2INT(arg1);
|
2393
2397
|
pos = (pos < 0) ? (max + pos) : pos;
|
2394
2398
|
if (pos < 0 || pos >= max) {
|
2395
|
-
rb_raise(rb_eArgError, "index %
|
2396
|
-
"IndexReader#[]", pos, 0, max
|
2399
|
+
rb_raise(rb_eArgError, "index %ld is out of range [%d..%ld] for "
|
2400
|
+
"IndexReader#[]", pos, 0, max);
|
2397
2401
|
}
|
2398
2402
|
return frb_get_lazy_doc(ir->get_lazy_doc(ir, pos));
|
2399
2403
|
}
|
data/ext/r_qparser.c
CHANGED
data/ext/r_search.c
CHANGED
@@ -207,8 +207,8 @@ frb_td_to_s(int argc, VALUE *argv, VALUE self)
|
|
207
207
|
field = frb_field(argv[0]);
|
208
208
|
}
|
209
209
|
|
210
|
-
sprintf(str, "TopDocs: total_hits = %ld, max_score = %
|
211
|
-
|
210
|
+
sprintf(str, "TopDocs: total_hits = %ld, max_score = %lf [\n",
|
211
|
+
FIX2LONG(rb_funcall(self, id_total_hits, 0)),
|
212
212
|
NUM2DBL(rb_funcall(self, id_max_score, 0)));
|
213
213
|
p = (int)strlen(str);
|
214
214
|
|
@@ -2676,7 +2676,7 @@ frb_sea_search_internal(Query *query, VALUE roptions, Searcher *sea)
|
|
2676
2676
|
else {
|
2677
2677
|
rb_raise(rb_eArgError, "%s is not a sensible :limit value "
|
2678
2678
|
"Please use a positive integer or :all",
|
2679
|
-
rb_obj_as_string(rval));
|
2679
|
+
rs2s(rb_obj_as_string(rval)));
|
2680
2680
|
}
|
2681
2681
|
}
|
2682
2682
|
if (Qnil != (rval = rb_hash_aref(roptions, sym_filter))) {
|
@@ -2911,7 +2911,7 @@ frb_sea_scan(int argc, VALUE *argv, VALUE self)
|
|
2911
2911
|
else {
|
2912
2912
|
rb_raise(rb_eArgError, "%s is not a sensible :limit value "
|
2913
2913
|
"Please use a positive integer or :all",
|
2914
|
-
rb_obj_as_string(rval));
|
2914
|
+
rs2s(rb_obj_as_string(rval)));
|
2915
2915
|
}
|
2916
2916
|
}
|
2917
2917
|
}
|
data/ext/ram_store.c
CHANGED
@@ -379,8 +379,9 @@ static InStream *ram_open_input(Store *store, const char *filename)
|
|
379
379
|
static int ram_lock_obtain(Lock *lock)
|
380
380
|
{
|
381
381
|
int ret = true;
|
382
|
-
if (ram_exists(lock->store, lock->name))
|
382
|
+
if (ram_exists(lock->store, lock->name)) {
|
383
383
|
ret = false;
|
384
|
+
}
|
384
385
|
ram_touch(lock->store, lock->name);
|
385
386
|
return ret;
|
386
387
|
}
|
data/ext/store.c
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
void with_lock(Lock *lock, void (*func)(void *arg), void *arg)
|
12
12
|
{
|
13
13
|
if (!lock->obtain(lock)) {
|
14
|
-
RAISE(
|
14
|
+
RAISE(LOCK_ERROR, "couldn't obtain lock \"%s\"", lock->name);
|
15
15
|
}
|
16
16
|
func(arg);
|
17
17
|
lock->release(lock);
|
data/ext/store.h
CHANGED
@@ -124,7 +124,7 @@ struct FrtInStream
|
|
124
124
|
} file;
|
125
125
|
union
|
126
126
|
{
|
127
|
-
off_t pointer;
|
127
|
+
off_t pointer; /* only used by RAMIn */
|
128
128
|
char *path; /* only used by FSIn */
|
129
129
|
FrtCompoundInStream *cis;
|
130
130
|
} d;
|
@@ -163,13 +163,13 @@ typedef struct FrtCompoundStore
|
|
163
163
|
struct FrtStore
|
164
164
|
{
|
165
165
|
int ref_cnt; /* for fs_store only */
|
166
|
-
frt_mutex_t mutex_i;
|
167
|
-
frt_mutex_t mutex;
|
166
|
+
frt_mutex_t mutex_i; /* for internal use only */
|
167
|
+
frt_mutex_t mutex; /* external mutex for use outside */
|
168
168
|
union
|
169
169
|
{
|
170
170
|
char *path; /* for fs_store only */
|
171
|
-
FrtHash *ht;
|
172
|
-
FrtCompoundStore *cmpd;
|
171
|
+
FrtHash *ht; /* for ram_store only */
|
172
|
+
FrtCompoundStore *cmpd; /* for compound_store only */
|
173
173
|
} dir;
|
174
174
|
|
175
175
|
#ifdef POSH_OS_WIN32
|
data/lib/ferret/field_symbol.rb
CHANGED
@@ -5,7 +5,7 @@ module Ferret
|
|
5
5
|
# __id__. It is useful for creating proxy classes. It is currently used by
|
6
6
|
# the FieldSymbol class which is a proxy to the Symbol class
|
7
7
|
class BlankSlate
|
8
|
-
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
|
8
|
+
instance_methods.each { |m| undef_method m unless m =~ /^__|object_id/ }
|
9
9
|
end
|
10
10
|
|
11
11
|
# The FieldSymbolMethods module contains the methods that are added to both
|
data/lib/ferret/version.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module StoreLockTest
|
2
2
|
class Switch
|
3
|
-
@@counter = 0
|
4
3
|
def Switch.counter() return @@counter end
|
5
4
|
def Switch.counter=(counter) @@counter = counter end
|
6
5
|
end
|
@@ -14,7 +13,7 @@ module StoreLockTest
|
|
14
13
|
assert(lock1.obtain(lock_time_out))
|
15
14
|
assert(lock2.locked?)
|
16
15
|
|
17
|
-
assert(! can_obtain_lock?(lock2))
|
16
|
+
assert(! can_obtain_lock?(lock2, lock_time_out))
|
18
17
|
|
19
18
|
exception_thrown = false
|
20
19
|
begin
|
@@ -31,6 +30,8 @@ module StoreLockTest
|
|
31
30
|
assert(lock2.obtain(lock_time_out))
|
32
31
|
lock2.release()
|
33
32
|
|
33
|
+
Switch.counter = 0
|
34
|
+
|
34
35
|
t = Thread.new() do
|
35
36
|
lock1.while_locked(lock_time_out) do
|
36
37
|
Switch.counter = 1
|
@@ -46,7 +47,8 @@ module StoreLockTest
|
|
46
47
|
while Switch.counter < 1
|
47
48
|
end
|
48
49
|
|
49
|
-
assert(! can_obtain_lock?(lock2
|
50
|
+
assert(! can_obtain_lock?(lock2, lock_time_out),
|
51
|
+
"lock 2 should not be obtainable")
|
50
52
|
|
51
53
|
Switch.counter = 2
|
52
54
|
while Switch.counter < 3
|
@@ -56,8 +58,7 @@ module StoreLockTest
|
|
56
58
|
lock2.release()
|
57
59
|
end
|
58
60
|
|
59
|
-
def can_obtain_lock?(lock)
|
60
|
-
lock_time_out = 0.001 # we want this test to run quickly
|
61
|
+
def can_obtain_lock?(lock, lock_time_out)
|
61
62
|
begin
|
62
63
|
lock.obtain(lock_time_out)
|
63
64
|
return true
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jk-ferret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 11
|
8
|
-
- 8
|
9
|
-
- 2
|
10
|
-
version: 0.11.8.2
|
4
|
+
version: 0.11.8.3
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- David Balmain
|
@@ -15,22 +9,19 @@ autorequire:
|
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
11
|
|
18
|
-
date:
|
12
|
+
date: 2011-02-22 00:00:00 +01:00
|
19
13
|
default_executable: ferret-browser
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: rake
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
20
|
requirements:
|
27
21
|
- - ">="
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
segments:
|
30
|
-
- 0
|
31
23
|
version: "0"
|
32
|
-
|
33
|
-
version_requirements: *id001
|
24
|
+
version:
|
34
25
|
description: Ferret is a super fast, highly configurable search library.
|
35
26
|
email: dbalmain@gmail.com
|
36
27
|
executables:
|
@@ -275,8 +266,6 @@ files:
|
|
275
266
|
- ext/term_vectors.c
|
276
267
|
- ext/threading.h
|
277
268
|
- ext/win32.h
|
278
|
-
- bin/ferret-browser
|
279
|
-
- ext/extconf.rb
|
280
269
|
has_rdoc: true
|
281
270
|
homepage: http://github.com/jkraemer/ferret
|
282
271
|
licenses: []
|
@@ -293,25 +282,21 @@ rdoc_options:
|
|
293
282
|
require_paths:
|
294
283
|
- lib
|
295
284
|
required_ruby_version: !ruby/object:Gem::Requirement
|
296
|
-
none: false
|
297
285
|
requirements:
|
298
286
|
- - ">="
|
299
287
|
- !ruby/object:Gem::Version
|
300
|
-
segments:
|
301
|
-
- 0
|
302
288
|
version: "0"
|
289
|
+
version:
|
303
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
304
|
-
none: false
|
305
291
|
requirements:
|
306
292
|
- - ">="
|
307
293
|
- !ruby/object:Gem::Version
|
308
|
-
segments:
|
309
|
-
- 0
|
310
294
|
version: "0"
|
295
|
+
version:
|
311
296
|
requirements: []
|
312
297
|
|
313
298
|
rubyforge_project: ferret
|
314
|
-
rubygems_version: 1.3.
|
299
|
+
rubygems_version: 1.3.5
|
315
300
|
signing_key:
|
316
301
|
specification_version: 3
|
317
302
|
summary: Ruby indexing library.
|