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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33a42ea75372a1f1cf7fa95c5f7ca88ad46d789c
4
- data.tar.gz: daf21ca47cc732516621bb5b05fa6a453655203a
3
+ metadata.gz: d495ebefe96291363c1b3f82a0ef41894c7a4272
4
+ data.tar.gz: 1abe36a2de4df79207a00c96c2e68f9de8dc4be0
5
5
  SHA512:
6
- metadata.gz: 68d63fc5779b3f3c3e19df5d403c7227ec8a4e233a82a23189db8bec15ce2fde2796706abaf913f45de8435116597cdc06b416d245972f634f781bceaf6cc8f8
7
- data.tar.gz: 9dc56616fb19d88bbab9ce34f22faf22494b1700faf1679eef3f45a1bc24c506fead2a4dbcc355b69b23bc056ba86f8672cd99bfd5b763b731d45c286ec5e045
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 version:"+@version.inspect+" from_version:"+from_version.inspect+" new_version:"+new_version.inspect+' --> '
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
- Hana::Patch.new(patch).apply(@object) if patch
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,nil,{}) if object.valid
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|
@@ -1,3 +1,3 @@
1
1
  module Seapig
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-21 00:00:00.000000000 Z
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