clindex 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/src/index.rb +4 -43
- metadata +25 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f19bf954833913173349da16acdd7e034b7673bb86b96114df4c2563ab20e0f9
|
4
|
+
data.tar.gz: 3c5fd6dc3d4b31a72be04826e03eab52313d9336e5e3fbacc4566f5d7a90d970
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e30b4c1698b16a41d7f96030d7ed57f94a38261e30346006a6c5506af5fdf59306aa4d3e00690088ff4497e3f9c8b07e42d6239216be0a1d404f971143527d86
|
7
|
+
data.tar.gz: c13c5ec5ceabf14f4b0158fcf093adf330692f380c44e00e7c03f0098616ed2d9f41554149a90a5a5556324c32a4e226adf3eeafc507c2eac40142cc88e9677b
|
data/src/index.rb
CHANGED
@@ -1,47 +1,10 @@
|
|
1
|
-
# $Id: index.rb,v 1.14 2003/05/28 22:57:28 chrismo Exp $
|
2
|
-
=begin
|
3
|
-
----------------------------------------------------------------------------
|
4
|
-
Copyright (c) 2002, Chris Morris
|
5
|
-
All rights reserved.
|
6
|
-
|
7
|
-
Redistribution and use in source and binary forms, with or without
|
8
|
-
modification, are permitted provided that the following conditions are met:
|
9
|
-
|
10
|
-
1. Redistributions of source code must retain the above copyright notice,
|
11
|
-
this list of conditions and the following disclaimer.
|
12
|
-
|
13
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
14
|
-
this list of conditions and the following disclaimer in the documentation
|
15
|
-
and/or other materials provided with the distribution.
|
16
|
-
|
17
|
-
3. Neither the names Chris Morris, cLabs nor the names of contributors to
|
18
|
-
this software may be used to endorse or promote products derived from this
|
19
|
-
software without specific prior written permission.
|
20
|
-
|
21
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
22
|
-
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
23
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
24
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
25
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
26
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
27
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
28
|
-
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
29
|
-
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
30
|
-
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
31
|
-
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
-
----------------------------------------------------------------------------
|
33
|
-
(based on BSD Open Source License)
|
34
|
-
=end
|
35
|
-
|
36
|
-
require 'thread'
|
37
1
|
require 'drb'
|
38
2
|
require 'rubygems'
|
39
3
|
gem 'clutil'
|
40
4
|
require 'cl/util/console'
|
41
5
|
|
42
|
-
# create a batch_add method? This would allow a whole
|
43
|
-
#
|
44
|
-
# locked for the duration to prevent a concurrent
|
6
|
+
# TODO: create a batch_add method? This would allow a whole page full of terms
|
7
|
+
# to be queued and the index locked for the duration to prevent a concurrent
|
45
8
|
# query from getting a partial result
|
46
9
|
class ClIndex
|
47
10
|
attr_accessor :index
|
@@ -103,7 +66,7 @@ class ClIndex
|
|
103
66
|
if locked
|
104
67
|
begin
|
105
68
|
File.open(filename, File::CREAT|File::TRUNC|File::RDWR) do |f|
|
106
|
-
Marshal.dump(
|
69
|
+
Marshal.dump(@index, f)
|
107
70
|
end
|
108
71
|
ensure
|
109
72
|
unlock(ClIndexLockMgr::SAVE)
|
@@ -116,11 +79,9 @@ class ClIndex
|
|
116
79
|
locked = lock(ClIndexLockMgr::LOAD, wait)
|
117
80
|
if locked
|
118
81
|
begin
|
119
|
-
src = nil
|
120
82
|
File.open(filename) do |f|
|
121
|
-
|
83
|
+
@index = Marshal.load(f)
|
122
84
|
end
|
123
|
-
assign(src)
|
124
85
|
ensure
|
125
86
|
unlock(ClIndexLockMgr::LOAD)
|
126
87
|
end
|
metadata
CHANGED
@@ -1,32 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- chrismo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: clutil
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 2011.138.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 2011.138.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
30
41
|
description: A generic index DRb server. The core index is a hash, each key is an
|
31
42
|
individual term, each value is an array of references for that term. Searches the
|
32
43
|
index with a simple regexp grep against the hash keys to return a single array of
|
@@ -41,26 +52,25 @@ files:
|
|
41
52
|
- src/index.rb
|
42
53
|
homepage: https://github.com/chrismo/clindex
|
43
54
|
licenses: []
|
55
|
+
metadata: {}
|
44
56
|
post_install_message:
|
45
57
|
rdoc_options: []
|
46
58
|
require_paths:
|
47
59
|
- src
|
48
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
61
|
requirements:
|
51
|
-
- -
|
62
|
+
- - "~>"
|
52
63
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
64
|
+
version: '2.4'
|
54
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
66
|
requirements:
|
57
|
-
- -
|
67
|
+
- - ">="
|
58
68
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
69
|
+
version: '0'
|
60
70
|
requirements: []
|
61
71
|
rubyforge_project:
|
62
|
-
rubygems_version:
|
72
|
+
rubygems_version: 2.7.6
|
63
73
|
signing_key:
|
64
|
-
specification_version:
|
74
|
+
specification_version: 4
|
65
75
|
summary: cLabs Index
|
66
76
|
test_files: []
|