seapig-server 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +0 -6
- data/bin/seapig-server +15 -3
- data/lib/seapig/version.rb +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: d495ebefe96291363c1b3f82a0ef41894c7a4272
|
4
|
+
data.tar.gz: 1abe36a2de4df79207a00c96c2e68f9de8dc4be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0ee3e9afb9052a0657e5cec69b9d1b11dbd25e0c4f8e53483f9d8600a6b98a86629f906a1ff0da8aa418b9cf87b2e35906be5634e1ad087918cdf582ec8291e
|
7
|
+
data.tar.gz: 16bb0c84bd01c7174bca9e72f25d918cf5eefb1f2a47d842ff25e7ac92c37e0dacded8d77757b5494a0c24e1fb007ca5d8f2ded898f2ce2c85db9fe378377475
|
data/Rakefile
CHANGED
@@ -14,12 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
#APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
-
#load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
|
21
|
-
#load 'rails/tasks/statistics.rake'
|
22
|
-
|
23
17
|
|
24
18
|
|
25
19
|
Bundler::GemHelper.install_tasks
|
data/bin/seapig-server
CHANGED
@@ -78,13 +78,18 @@ class SeapigObject
|
|
78
78
|
|
79
79
|
|
80
80
|
def patch(patch, value, from_version, new_version)
|
81
|
-
print "Patching
|
81
|
+
print "Patching:\n\tversion:"+@version.inspect+"\n\tfrom_version: "+from_version.inspect+"\n\tnew_version: "+new_version.inspect+"\n\tpatch_size: "+(patch and patch.size.to_s or "nil")+"\n\t--> "
|
82
82
|
if from_version == @version or from_version == 0
|
83
83
|
puts 'Clean'
|
84
84
|
old_object = JSON.load(JSON.dump(@object))
|
85
85
|
old_version = @version
|
86
86
|
@object.clear if from_version == 0 or value
|
87
|
-
|
87
|
+
begin
|
88
|
+
Hana::Patch.new(patch).apply(@object) if patch
|
89
|
+
rescue Exception => e
|
90
|
+
puts "Patching failed!\n\tOld object: "+old_object.inspect+"\n\tPatch: "+patch.inspect
|
91
|
+
raise e
|
92
|
+
end
|
88
93
|
@object.merge!(value) if value
|
89
94
|
@version = new_version
|
90
95
|
Client.all.each { |client| send(client, old_version, old_object) }
|
@@ -182,11 +187,17 @@ class Client
|
|
182
187
|
Client.all.each { |client| client.produces.each { |pattern| SeapigObject[pattern] if (not pattern.starexp?) and (pattern =~ object.id.starexp) } } if object.id.starexp?
|
183
188
|
SeapigObject.matching(object.id).each { |object|
|
184
189
|
Client.all.find { |client| client.assign(object) }
|
185
|
-
object.send(self,
|
190
|
+
object.send(self,0,{}) if object.valid
|
186
191
|
}
|
187
192
|
end
|
188
193
|
|
189
194
|
|
195
|
+
def consumer_unregister(object)
|
196
|
+
@consumes.delete(object)
|
197
|
+
SeapigObject.gc
|
198
|
+
end
|
199
|
+
|
200
|
+
|
190
201
|
def assign(object)
|
191
202
|
puts 'Assign? %20s <> %-30s - %s'%[self.id, object.id, [object.valid,object.id.starexp?,@producing,Client.all.find { |client| client.producing == object },(not @produces.find { |pattern| object.id =~ pattern.starexp })].map { |b| b and 'T' or 'F' }.join('')]
|
192
203
|
return true if object.valid
|
@@ -272,6 +283,7 @@ EM.run {
|
|
272
283
|
client_socket.onpong { Client[client_socket].pong }
|
273
284
|
}
|
274
285
|
|
286
|
+
Socket.open(:UNIX, :DGRAM) { |s| s.connect(Socket.pack_sockaddr_un(ENV['NOTIFY_SOCKET'])); s.sendmsg "READY=1" } if ENV['NOTIFY_SOCKET']
|
275
287
|
|
276
288
|
EM.add_periodic_timer(10) {
|
277
289
|
Client.all.each { |client|
|
data/lib/seapig/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seapig-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yunta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-eventmachine-server
|