linda-socket.io-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.txt +4 -0
- data/lib/linda-socket.io-client/client.rb +24 -10
- data/lib/linda-socket.io-client/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58a6a89d7ff007812167f158514b009e65c78178
|
4
|
+
data.tar.gz: f6c195ca20d5033bfea38854a30a0524d4f0afc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8a463651c25509de443a6072bc3ebaff7770d60c7e0e71e71cb3005c8df92dc5b59b703a393a0f2debc70c2888e29f4e52fa4b5562a20f6a18657b2a233683
|
7
|
+
data.tar.gz: 896d9db672bb63301d75a38e6b37104fd8fec8ad72cae44d56ce60e75e225638af1a02dd6ac7f302e7b5e2ec1f94e47eff66d425b78d700cdda8506834082874
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
@@ -39,6 +39,27 @@ module Linda
|
|
39
39
|
@name = name
|
40
40
|
@linda = linda
|
41
41
|
@watch_callback_ids = {}
|
42
|
+
@io_callback_ids = []
|
43
|
+
this = self
|
44
|
+
@linda.io.on 'disconnect' do
|
45
|
+
this.remove_io_callbacks
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_callback_id
|
50
|
+
"#{Time.now.to_i}_#{rand 10000}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_watch_callback_id(tuple)
|
54
|
+
key = tuple.to_json
|
55
|
+
return @watch_callback_ids[key] ||= create_callback_id
|
56
|
+
end
|
57
|
+
|
58
|
+
def remove_io_callbacks
|
59
|
+
@io_callback_ids.each do |id|
|
60
|
+
@linda.io.remove_listener id
|
61
|
+
end
|
62
|
+
@io_callback_ids = []
|
42
63
|
end
|
43
64
|
|
44
65
|
def write(tuple, opts={})
|
@@ -53,6 +74,7 @@ module Linda
|
|
53
74
|
io_cid = @linda.io.once name do |err, tuple|
|
54
75
|
block.call err, Tuple.new(tuple)
|
55
76
|
end
|
77
|
+
@io_callback_ids.push io_cid
|
56
78
|
@linda.io.emit '__linda_take', {:tuplespace => @name, :tuple => tuple, :id => id}
|
57
79
|
return id
|
58
80
|
end
|
@@ -64,6 +86,7 @@ module Linda
|
|
64
86
|
io_cid = @linda.io.once name do |err, tuple|
|
65
87
|
block.call err, Tuple.new(tuple)
|
66
88
|
end
|
89
|
+
@io_callback_ids.push io_cid
|
67
90
|
@linda.io.emit '__linda_read', {:tuplespace => @name, :tuple => tuple, :id => id}
|
68
91
|
return id
|
69
92
|
end
|
@@ -75,6 +98,7 @@ module Linda
|
|
75
98
|
io_cid = @linda.io.on name do |err, tuple|
|
76
99
|
block.call err, Tuple.new(tuple)
|
77
100
|
end
|
101
|
+
@io_callback_ids.push io_cid
|
78
102
|
@linda.io.emit '__linda_watch', {:tuplespace => @name, :tuple => tuple, :id => id}
|
79
103
|
return id
|
80
104
|
end
|
@@ -83,16 +107,6 @@ module Linda
|
|
83
107
|
@linda.io.emit '__linda_cancel', {:tuplespace => @name, :id => id}
|
84
108
|
end
|
85
109
|
|
86
|
-
private
|
87
|
-
def create_callback_id
|
88
|
-
"#{Time.now.to_i}_#{rand 10000}"
|
89
|
-
end
|
90
|
-
|
91
|
-
def create_watch_callback_id(tuple)
|
92
|
-
key = tuple.to_json
|
93
|
-
return @watch_callback_ids[key] ||= create_callback_id
|
94
|
-
end
|
95
|
-
|
96
110
|
end
|
97
111
|
|
98
112
|
end
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linda-socket.io-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|