familia 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +4 -2
- data/README.md +1 -1
- data/VERSION.yml +1 -1
- data/familia.gemspec +1 -1
- data/lib/familia/redisobject.rb +6 -1
- data/lib/familia.rb +5 -2
- data/try/00_familia_try.rb +21 -0
- data/try/20_redis_object_try.rb +3 -4
- data/try/26_redis_bool_try.rb +39 -0
- metadata +8 -7
- data/try/00_familia.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6094ea590e66afd51a244fc0bdb4eaa3252a26cd3c1a7da445b5a222a44b9cca
|
4
|
+
data.tar.gz: 235b5ffc47898796c08fdcaca31341ff236bca5ea6b70aa1a11e3dc14617bd5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2cce70440beb24a905a139b316d03db97df8e91e7651c75cec4616276f75db22576afde2c257ff7b92dc6eab2cb0e902d2743f28334ff5048f76dff5c7cb39
|
7
|
+
data.tar.gz: cd67c6ee621157797594186cf9487e2cf2fd24e756d1a21f3534556e0e3b9938dcb119346df3e96659cac072c1cc080b3394d59950fde264fe28230f92ba12fc
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,6 +7,8 @@ on:
|
|
7
7
|
|
8
8
|
pull_request:
|
9
9
|
|
10
|
+
workflow_dispatch:
|
11
|
+
|
10
12
|
jobs:
|
11
13
|
build:
|
12
14
|
runs-on: ubuntu-latest
|
@@ -49,7 +51,7 @@ jobs:
|
|
49
51
|
- 6379:6379
|
50
52
|
|
51
53
|
steps:
|
52
|
-
- uses: actions/checkout@
|
54
|
+
- uses: actions/checkout@v4
|
53
55
|
- name: Set up Ruby
|
54
56
|
uses: ruby/setup-ruby@v1
|
55
57
|
with:
|
@@ -66,4 +68,4 @@ jobs:
|
|
66
68
|
run: bundle install
|
67
69
|
|
68
70
|
- name: Run the tryouts
|
69
|
-
run: bundle exec try -v
|
71
|
+
run: bundle exec try -v try/*_try.rb
|
data/README.md
CHANGED
data/VERSION.yml
CHANGED
data/familia.gemspec
CHANGED
data/lib/familia/redisobject.rb
CHANGED
@@ -46,7 +46,7 @@ module Familia
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
attr_reader :name, :parent
|
49
|
+
attr_reader :name, :parent
|
50
50
|
attr_writer :redis
|
51
51
|
|
52
52
|
# RedisObject instances are frozen. `cache` is a hash
|
@@ -818,6 +818,11 @@ module Familia
|
|
818
818
|
ret = redis.hset rediskey, n, to_redis(v)
|
819
819
|
update_expiration
|
820
820
|
ret
|
821
|
+
rescue TypeError => e
|
822
|
+
echo :hset, caller[0] if Familia.debug
|
823
|
+
klass = v.class
|
824
|
+
msg = "Cannot store #{n} => #{v.inspect} (#{klass}) in #{rediskey}"
|
825
|
+
raise e.class, msg
|
821
826
|
end
|
822
827
|
alias_method :put, :[]=
|
823
828
|
alias_method :store, :[]=
|
data/lib/familia.rb
CHANGED
@@ -32,10 +32,13 @@ module Familia
|
|
32
32
|
@debug = false
|
33
33
|
@dump_method = :to_json
|
34
34
|
@load_method = :from_json
|
35
|
+
|
35
36
|
class << self
|
36
37
|
attr_reader :clients, :uri, :logger
|
37
38
|
attr_accessor :debug, :secret, :delim, :dump_method, :load_method
|
38
39
|
attr_writer :apiversion
|
40
|
+
|
41
|
+
alias_method :url, :uri
|
39
42
|
def debug?() @debug == true end
|
40
43
|
def info *msg
|
41
44
|
STDERR.puts *msg
|
@@ -48,7 +51,7 @@ module Familia
|
|
48
51
|
end
|
49
52
|
def trace label, redis_instance, ident, context=nil
|
50
53
|
return unless Familia.debug?
|
51
|
-
info "[%s] %s
|
54
|
+
info "[%s] %s %s" % [label, redis_instance.id, ident]
|
52
55
|
if context
|
53
56
|
context = [context].flatten
|
54
57
|
context.reject! { |line| line =~ /lib\/familia/ }
|
@@ -87,7 +90,7 @@ module Familia
|
|
87
90
|
uri ||= Familia.uri
|
88
91
|
conf = uri.conf
|
89
92
|
redis = Redis.new conf
|
90
|
-
Familia.trace
|
93
|
+
Familia.trace(:CONNECT, redis, conf.inspect, caller[0..3])
|
91
94
|
@clients[uri.serverid] = redis
|
92
95
|
end
|
93
96
|
def reconnect_all!
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'familia'
|
2
|
+
require 'familia/test_helpers'
|
3
|
+
|
4
|
+
Familia.apiversion = 'v1'
|
5
|
+
|
6
|
+
|
7
|
+
## Check for help class
|
8
|
+
Bone.redis_objects.keys # consistent b/c hashes are ordered
|
9
|
+
#=> [:owners, :tags, :metrics, :props, :value]
|
10
|
+
|
11
|
+
## Familia has a uri
|
12
|
+
Familia.uri.class
|
13
|
+
#=> URI::Redis
|
14
|
+
|
15
|
+
## Familia has a uri as a string
|
16
|
+
Familia.uri.to_s
|
17
|
+
#=> 'redis://127.0.0.1'
|
18
|
+
|
19
|
+
## Familia has a url, an alias to uri
|
20
|
+
Familia.url.eql?(Familia.uri)
|
21
|
+
#=> true
|
data/try/20_redis_object_try.rb
CHANGED
@@ -7,14 +7,13 @@ Familia.apiversion = 'v1'
|
|
7
7
|
## Redis Objects are unique per instance of a Familia class
|
8
8
|
@a = Bone.new 'atoken', :name1
|
9
9
|
@b = Bone.new 'atoken', :name2
|
10
|
-
@a.owners.rediskey
|
10
|
+
@a.owners.rediskey.eql?(@b.owners.rediskey)
|
11
11
|
#=> false
|
12
12
|
|
13
|
-
## Redis Objects are frozen
|
13
|
+
## Redis Objects are frozen
|
14
14
|
@a.owners.frozen?
|
15
15
|
#=> true
|
16
16
|
|
17
|
-
|
18
17
|
## Limiter#qstamp
|
19
18
|
@limiter = Limiter.new :requests
|
20
19
|
@limiter.counter.qstamp 10.minutes, '%H:%M', 1302468980
|
@@ -42,4 +41,4 @@ Familia.apiversion = 'v1'
|
|
42
41
|
## Check realttl
|
43
42
|
sleep 1
|
44
43
|
@limiter.counter.realttl
|
45
|
-
#=> 3600-1
|
44
|
+
#=> 3600-1
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'familia'
|
2
|
+
require 'familia/test_helpers'
|
3
|
+
|
4
|
+
Familia.debug = true
|
5
|
+
|
6
|
+
@hashkey = Familia::HashKey.new 'key'
|
7
|
+
|
8
|
+
|
9
|
+
## Boolean values are returned as strings, on assignment as string
|
10
|
+
@hashkey["test"] = "true"
|
11
|
+
#=> "true"
|
12
|
+
|
13
|
+
## Boolean values are returned as strings
|
14
|
+
@hashkey["test"]
|
15
|
+
#=> "true"
|
16
|
+
|
17
|
+
## Trying to store a boolean value to a hash key raises an exception
|
18
|
+
begin
|
19
|
+
@hashkey["test"] = true
|
20
|
+
rescue TypeError => e
|
21
|
+
e.message
|
22
|
+
end
|
23
|
+
#=> "Cannot store test => true (TrueClass) in key"
|
24
|
+
|
25
|
+
## Boolean values are returned as strings
|
26
|
+
@hashkey["test"]
|
27
|
+
#=> "true"
|
28
|
+
|
29
|
+
## Trying to store a nil value to a hash key raises an exception
|
30
|
+
begin
|
31
|
+
@hashkey["test"] = nil
|
32
|
+
rescue TypeError => e
|
33
|
+
e.message
|
34
|
+
end
|
35
|
+
#=> "Cannot store test => nil (NilClass) in key"
|
36
|
+
|
37
|
+
## The exceptions prevented the hash from being updated
|
38
|
+
@hashkey["test"]
|
39
|
+
#=> "true"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: familia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Familia: Organize and store ruby objects in Redis'
|
14
14
|
email: gems@solutious.com
|
@@ -32,7 +32,7 @@ files:
|
|
32
32
|
- lib/familia/redisobject.rb
|
33
33
|
- lib/familia/test_helpers.rb
|
34
34
|
- lib/familia/tools.rb
|
35
|
-
- try/
|
35
|
+
- try/00_familia_try.rb
|
36
36
|
- try/10_familia_try.rb
|
37
37
|
- try/20_redis_object_try.rb
|
38
38
|
- try/21_redis_object_zset_try.rb
|
@@ -40,12 +40,13 @@ files:
|
|
40
40
|
- try/23_redis_object_list_try.rb
|
41
41
|
- try/24_redis_object_string_try.rb
|
42
42
|
- try/25_redis_object_hash_try.rb
|
43
|
+
- try/26_redis_bool_try.rb
|
43
44
|
- try/30_familia_object_try.rb
|
44
45
|
homepage: https://github.com/delano/familia
|
45
46
|
licenses:
|
46
47
|
- MIT
|
47
48
|
metadata: {}
|
48
|
-
post_install_message:
|
49
|
+
post_install_message:
|
49
50
|
rdoc_options: []
|
50
51
|
require_paths:
|
51
52
|
- lib
|
@@ -60,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
61
|
- !ruby/object:Gem::Version
|
61
62
|
version: '0'
|
62
63
|
requirements: []
|
63
|
-
rubygems_version: 3.
|
64
|
-
signing_key:
|
64
|
+
rubygems_version: 3.1.6
|
65
|
+
signing_key:
|
65
66
|
specification_version: 4
|
66
67
|
summary: Organize and store ruby objects in Redis
|
67
68
|
test_files: []
|