agis 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/agis.rb +42 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ea2ef4e507cea68fd6658697e07057904330567
|
4
|
+
data.tar.gz: 6f47831882d708fab0a8806cbb3f27502ddc6f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61b311da1175aa2483c77837519d6e3c598ea566acc1d70b7dd625e3f06f44138a0297a7aa05a2dbc23841a42c6dca199dde283f9a7991d7fe94f08af5394f2a
|
7
|
+
data.tar.gz: 79890cdb4d074f5eca258dfdbf42ebe4fe02423ce9b4b800671ba1f7628dfdd38587f34ceed26342e57bf6106354e82baccefd8514ee4d109ab2286e6810638e
|
data/lib/agis.rb
CHANGED
@@ -19,10 +19,8 @@ module Agis
|
|
19
19
|
|
20
20
|
class MessageBoxEmpty < StandardError
|
21
21
|
end
|
22
|
-
|
23
|
-
|
24
|
-
# the lock is this string followed by ".LOCK"
|
25
|
-
def agis_mailbox
|
22
|
+
|
23
|
+
def agis_id_prelim
|
26
24
|
begin
|
27
25
|
mid = self.agis_id
|
28
26
|
rescue NoMethodError
|
@@ -31,6 +29,13 @@ module Agis
|
|
31
29
|
mid ||= self.id
|
32
30
|
rescue NoMethodError
|
33
31
|
end
|
32
|
+
return mid
|
33
|
+
end
|
34
|
+
|
35
|
+
# the name of the key used for the Agis message box in Redis
|
36
|
+
# the lock is this string followed by ".LOCK"
|
37
|
+
def agis_mailbox
|
38
|
+
mid = agis_id_prelim
|
34
39
|
raise NoAgisIDAvailable unless mid
|
35
40
|
a = "AGIS TERMINAL : " + self.class.to_s + " : " + mid.to_s
|
36
41
|
end
|
@@ -236,6 +241,36 @@ module Agis
|
|
236
241
|
end
|
237
242
|
end
|
238
243
|
|
244
|
+
# Find all mailboxes total
|
245
|
+
def _agis_find_global_mailboxes(redis)
|
246
|
+
redis.smembers("AGIS_MAILBOX_GLOBAL_LIST")
|
247
|
+
end
|
248
|
+
|
249
|
+
# Find all mailboxes for this class
|
250
|
+
def agis_find_all_mailboxes(redis)
|
251
|
+
redis.smembers("AGIS_MAILBOX_CLASS:" + self.class.to_s)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Crunch all agis calls on a single model
|
255
|
+
# found using the #find method with the
|
256
|
+
# agis_id or id. Must be numeric
|
257
|
+
def agis_crunch_all_records(redis)
|
258
|
+
all = agis_find_all_mailboxes(redis)
|
259
|
+
all.each do |id|
|
260
|
+
self.class.find(id).agis_call(redis)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# Crunch all agis calls on a single model
|
265
|
+
# found using the #new method with id set
|
266
|
+
# to agis_id or id
|
267
|
+
def agis_crunch_all_records_new(redis)
|
268
|
+
all = agis_find_all_mailboxes(redis)
|
269
|
+
all.each do |id|
|
270
|
+
self.class.new(id).agis_call(redis)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
239
274
|
# Get method in the format
|
240
275
|
# [arity, method body]
|
241
276
|
def agis_method(name)
|
@@ -249,6 +284,9 @@ module Agis
|
|
249
284
|
until_sig = Time.now.to_s + ":" + Process.pid.to_s + Random.new.rand(4000000000).to_s + Random.new.rand(4000000000).to_s
|
250
285
|
loop do
|
251
286
|
begin
|
287
|
+
redis.sadd("AGIS_MAILBOX_CLASSES", self.class.to_s)
|
288
|
+
redis.sadd("AGIS_MAILBOX_CLASS:" + self.class.to_s, self.agis_id_prelim)
|
289
|
+
redis.sadd("AGIS_MAILBOX_GLOBAL_LIST", self.agis_mailbox)
|
252
290
|
redis.multi do
|
253
291
|
redis.rpush self.agis_mailbox, "m:" + name.to_s
|
254
292
|
redis.rpush self.agis_mailbox, agis_aconv(arg1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gert Oja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
67
|
rubyforge_project:
|
68
|
-
rubygems_version: 2.4.
|
68
|
+
rubygems_version: 2.4.8
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Messagebox Redis Actors for Ruby
|