relix 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md ADDED
@@ -0,0 +1,26 @@
1
+ ### 1.1.1
2
+
3
+ * Added keyers to the manifest file. (ntalbott)
4
+
5
+ ### 1.1.0
6
+
7
+ * Fixed and tested concurrency support. (ntalbott)
8
+ * Added Relix::Error that all errors inherit from. (ntalbott)
9
+ * Added support for deindexing a model. (myronmarston)
10
+ * Bring sanity to key construction and make keyers pluggable. (ntalbott)
11
+
12
+ ### 1.0.3
13
+
14
+ * Back the Rubygems dependency down some.
15
+
16
+ ### 1.0.2
17
+
18
+ * Allow configuring the Redis host.
19
+
20
+ ### 1.0.1
21
+
22
+ * Add all the new files in lib to gemspec.
23
+
24
+ ### 1.0.0
25
+
26
+ * First official release.
@@ -0,0 +1,88 @@
1
+ module Relix
2
+ def self.default_keyer(keyer=nil, options={})
3
+ if keyer
4
+ @default_keyer ||= [keyer, options]
5
+ else
6
+ @default_keyer
7
+ end
8
+ end
9
+
10
+ module Keyer
11
+ def self.default_for(klass)
12
+ dk = Relix.default_keyer
13
+ dk.first.new(klass, dk.last)
14
+ end
15
+
16
+ class Legacy
17
+ def initialize(klass, options)
18
+ @prefix = klass.name
19
+ end
20
+
21
+ def values(pk)
22
+ "#{@prefix}:current_values:#{pk}"
23
+ end
24
+
25
+ def index(index, name)
26
+ case index
27
+ when PrimaryKeyIndex
28
+ "#{index.class.name}:#{@prefix}:primary_key"
29
+ else
30
+ "#{index.class.name}:#{@prefix}:#{name}"
31
+ end
32
+ end
33
+
34
+ def component(name, component)
35
+ if name =~ /^Relix::UniqueIndex:/
36
+ component = case component
37
+ when 'lookup'
38
+ 'hash'
39
+ when 'ordering'
40
+ 'zset'
41
+ else
42
+ component
43
+ end
44
+ end
45
+
46
+ "#{name}:#{component}"
47
+ end
48
+ end
49
+
50
+ class Standard
51
+ def initialize(klass, options)
52
+ @prefix = klass.name
53
+ end
54
+
55
+ def values(pk)
56
+ "#{@prefix}:values:#{pk}"
57
+ end
58
+
59
+ def index(index, name)
60
+ "#{@prefix}:#{name}:#{index.class.kind}"
61
+ end
62
+
63
+ def component(name, component)
64
+ "#{name}:#{component}"
65
+ end
66
+ end
67
+
68
+ class Compact < Standard
69
+ def initialize(klass, options)
70
+ @prefix = if(abbrev = options[:abbrev])
71
+ (abbrev.respond_to?(:call) ? abbrev.call(klass.name) : abbrev)
72
+ else
73
+ klass.name
74
+ end
75
+ end
76
+
77
+ def values(pk)
78
+ "#{@prefix}:v:#{pk}"
79
+ end
80
+
81
+ def index(index, name)
82
+ "#{@prefix}:#{name}:#{index.class.compact_kind}"
83
+ end
84
+ end
85
+ end
86
+
87
+ default_keyer(Keyer::Standard)
88
+ end
data/lib/relix/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Relix
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hiredis
16
- requirement: &70209042647380 !ruby/object:Gem::Requirement
16
+ requirement: &70249249266500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70209042647380
24
+ version_requirements: *70249249266500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis
27
- requirement: &70209042646920 !ruby/object:Gem::Requirement
27
+ requirement: &70249249266000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 2.2.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70209042646920
35
+ version_requirements: *70249249266000
36
36
  description: ! 'Relix is a layer that can be added on to any model to make all the
37
37
  normal types of querying you want to do: equality, less than/greater than, in set,
38
38
  range, limit, etc., quick and painless. Relix depends on Redis to be awesome at
@@ -44,6 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - HISTORY.md
47
48
  - README.md
48
49
  - lib/relix.rb
49
50
  - lib/relix/core.rb
@@ -52,6 +53,7 @@ files:
52
53
  - lib/relix/indexes/primary_key.rb
53
54
  - lib/relix/indexes/unique.rb
54
55
  - lib/relix/index_set.rb
56
+ - lib/relix/keyer.rb
55
57
  - lib/relix/query.rb
56
58
  - lib/relix/redis.rb
57
59
  - lib/relix/version.rb
@@ -69,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
71
  version: '0'
70
72
  segments:
71
73
  - 0
72
- hash: 2795857590381463961
74
+ hash: 187409947092406271
73
75
  required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  none: false
75
77
  requirements: