tamashii-manager 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tamashii/manager/client.rb +2 -2
- data/lib/tamashii/manager/server.rb +2 -1
- data/lib/tamashii/manager/stream_event_loop.rb +16 -2
- data/lib/tamashii/manager/version.rb +1 -1
- data/tags +121 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3615a69b16faac2730ca38fa2f42161db5e89d50
|
4
|
+
data.tar.gz: 31482ad7e7c1c76fe0dee4651f0b7f21cf53e347
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f89bf3e52e8a1121518e385e07b96287d472159e1321ed9ba46dceb484eec2bf5cebd568244f5cf923e7e78307326ca3c9840a6725a352c04c7d9e7d6d1afceb
|
7
|
+
data.tar.gz: c982c585c7088e7e795e28a221c00262d88ad3f88a8d061457002af66a47630b1ad830f37211dc0d345f7e9c4db655c56bb4f81bf1fbf0f1d8c2979faa04a753
|
@@ -94,7 +94,7 @@ module Tamashii
|
|
94
94
|
Clients.unregister(self)
|
95
95
|
end
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
def beat
|
99
99
|
beat_time = Time.now
|
100
100
|
@driver.ping("heart-beat-at-#{beat_time}") do
|
@@ -105,7 +105,7 @@ module Tamashii
|
|
105
105
|
def heartbeat_callback(beat_time)
|
106
106
|
@last_beat_timestamp = Time.now
|
107
107
|
@last_response_time = @last_beat_timestamp - beat_time
|
108
|
-
Manager.logger.debug "[#{@id}] Heart beat #{beat_time} returns at #{@last_beat_timestamp}! Delay: #{(@last_response_time * 1000).round} ms"
|
108
|
+
Manager.logger.debug "[#{@id}] Heart beat #{beat_time} returns at #{@last_beat_timestamp}! Delay: #{(@last_response_time * 1000).round} ms"
|
109
109
|
end
|
110
110
|
|
111
111
|
private
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "json"
|
2
2
|
require "securerandom"
|
3
3
|
require "websocket/driver"
|
4
|
+
require "monitor"
|
4
5
|
|
5
6
|
require "tamashii/manager/client"
|
6
7
|
require "tamashii/manager/stream"
|
@@ -12,7 +13,7 @@ module Tamashii
|
|
12
13
|
class << self
|
13
14
|
attr_reader :instance
|
14
15
|
|
15
|
-
LOCK =
|
16
|
+
LOCK = Monitor.new
|
16
17
|
|
17
18
|
def compile
|
18
19
|
@instance ||= new
|
@@ -2,6 +2,8 @@ require 'nio'
|
|
2
2
|
require 'thread'
|
3
3
|
require 'concurrent'
|
4
4
|
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
|
5
7
|
module Tamashii
|
6
8
|
module Manager
|
7
9
|
class StreamEventLoop
|
@@ -87,8 +89,20 @@ module Tamashii
|
|
87
89
|
stream = monitor.value
|
88
90
|
|
89
91
|
begin
|
90
|
-
|
91
|
-
|
92
|
+
if monitor.writable?
|
93
|
+
if stream.flush_writer_buffer
|
94
|
+
monitor.interests = :r
|
95
|
+
end
|
96
|
+
next unless monitor.readable?
|
97
|
+
end
|
98
|
+
|
99
|
+
incoming = io.read_nonblock(4096, exception: false)
|
100
|
+
case incoming
|
101
|
+
when :wait_readable then next
|
102
|
+
when nil then stream.close
|
103
|
+
else
|
104
|
+
stream.receive incoming
|
105
|
+
end
|
92
106
|
rescue
|
93
107
|
begin
|
94
108
|
stream.close
|
data/tags
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
+
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
+
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
+
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
+
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
+
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
+
Authorization lib/tamashii/manager/authorization.rb /^ class Authorization < Tamashii::Handler$/;" c language:Ruby class:Tamashii.Manager
|
8
|
+
AuthorizationError lib/tamashii/manager/errors/authorization_error.rb /^ class AuthorizationError < RuntimeError$/;" c language:Ruby class:Tamashii.Manager
|
9
|
+
Authorizator lib/tamashii/manager/authorizator/token.rb /^ module Authorizator$/;" m language:Ruby class:Tamashii.Manager
|
10
|
+
Broadcaster lib/tamashii/manager/handler/broadcaster.rb /^ class Broadcaster < Tamashii::Handler$/;" c language:Ruby class:Tamashii.Manager.Handler
|
11
|
+
Channel lib/tamashii/manager/channel.rb /^ class Channel < Set$/;" c language:Ruby class:Tamashii.Manager
|
12
|
+
ChannelPool lib/tamashii/manager/channel_pool.rb /^ class ChannelPool < Hash$/;" c language:Ruby class:Tamashii.Manager
|
13
|
+
Client lib/tamashii/manager/client.rb /^ class Client$/;" c language:Ruby class:Tamashii.Manager
|
14
|
+
Clients lib/tamashii/manager/clients.rb /^ class Clients < Hash$/;" c language:Ruby class:Tamashii.Manager
|
15
|
+
Config lib/tamashii/manager/config.rb /^ class Config < Tamashii::Config$/;" c language:Ruby class:Tamashii.Manager
|
16
|
+
Connection lib/tamashii/manager/connection.rb /^ class Connection < Set$/;" c language:Ruby class:Tamashii.Manager
|
17
|
+
Handler lib/tamashii/manager/handler/broadcaster.rb /^ module Handler$/;" m language:Ruby class:Tamashii.Manager
|
18
|
+
Manager lib/tamashii/manager.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
19
|
+
Manager lib/tamashii/manager/authorization.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
20
|
+
Manager lib/tamashii/manager/authorizator/token.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
21
|
+
Manager lib/tamashii/manager/channel.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
22
|
+
Manager lib/tamashii/manager/channel_pool.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
23
|
+
Manager lib/tamashii/manager/client.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
24
|
+
Manager lib/tamashii/manager/clients.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
25
|
+
Manager lib/tamashii/manager/config.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
26
|
+
Manager lib/tamashii/manager/connection.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
27
|
+
Manager lib/tamashii/manager/errors/authorization_error.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
28
|
+
Manager lib/tamashii/manager/handler/broadcaster.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
29
|
+
Manager lib/tamashii/manager/server.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
30
|
+
Manager lib/tamashii/manager/stream.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
31
|
+
Manager lib/tamashii/manager/stream_event_loop.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
32
|
+
Manager lib/tamashii/manager/version.rb /^ module Manager$/;" m language:Ruby class:Tamashii
|
33
|
+
Server lib/tamashii/manager/server.rb /^ class Server$/;" c language:Ruby class:Tamashii.Manager
|
34
|
+
Stream lib/tamashii/manager/stream.rb /^ class Stream$/;" c language:Ruby class:Tamashii.Manager
|
35
|
+
StreamEventLoop lib/tamashii/manager/stream_event_loop.rb /^ class StreamEventLoop$/;" c language:Ruby class:Tamashii.Manager
|
36
|
+
Tamashii lib/tamashii/manager.rb /^module Tamashii$/;" m language:Ruby
|
37
|
+
Tamashii lib/tamashii/manager/authorization.rb /^module Tamashii$/;" m language:Ruby
|
38
|
+
Tamashii lib/tamashii/manager/authorizator/token.rb /^module Tamashii$/;" m language:Ruby
|
39
|
+
Tamashii lib/tamashii/manager/channel.rb /^module Tamashii$/;" m language:Ruby
|
40
|
+
Tamashii lib/tamashii/manager/channel_pool.rb /^module Tamashii$/;" m language:Ruby
|
41
|
+
Tamashii lib/tamashii/manager/client.rb /^module Tamashii$/;" m language:Ruby
|
42
|
+
Tamashii lib/tamashii/manager/clients.rb /^module Tamashii$/;" m language:Ruby
|
43
|
+
Tamashii lib/tamashii/manager/config.rb /^module Tamashii$/;" m language:Ruby
|
44
|
+
Tamashii lib/tamashii/manager/connection.rb /^module Tamashii$/;" m language:Ruby
|
45
|
+
Tamashii lib/tamashii/manager/errors/authorization_error.rb /^module Tamashii$/;" m language:Ruby
|
46
|
+
Tamashii lib/tamashii/manager/handler/broadcaster.rb /^module Tamashii$/;" m language:Ruby
|
47
|
+
Tamashii lib/tamashii/manager/server.rb /^module Tamashii$/;" m language:Ruby
|
48
|
+
Tamashii lib/tamashii/manager/stream.rb /^module Tamashii$/;" m language:Ruby
|
49
|
+
Tamashii lib/tamashii/manager/stream_event_loop.rb /^module Tamashii$/;" m language:Ruby
|
50
|
+
Tamashii lib/tamashii/manager/version.rb /^module Tamashii$/;" m language:Ruby
|
51
|
+
Token lib/tamashii/manager/authorizator/token.rb /^ class Token$/;" c language:Ruby class:Tamashii.Manager.Authorizator
|
52
|
+
accept lib/tamashii/manager/client.rb /^ def accept(type, id)$/;" f language:Ruby class:Tamashii.Manager.Client
|
53
|
+
accepted_clients lib/tamashii/manager/client.rb /^ def self.accepted_clients$/;" F language:Ruby class:Tamashii.Manager.Client
|
54
|
+
attach lib/tamashii/manager/stream_event_loop.rb /^ def attach(io, stream)$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
55
|
+
auth_type lib/tamashii/manager/config.rb /^ def auth_type(type = nil)$/;" f language:Ruby class:Tamashii.Manager.Config
|
56
|
+
authorized? lib/tamashii/manager/client.rb /^ def authorized?$/;" f language:Ruby class:Tamashii.Manager.Client
|
57
|
+
available? lib/tamashii/manager/channel_pool.rb /^ def available?$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
58
|
+
available? lib/tamashii/manager/connection.rb /^ def available?$/;" f language:Ruby class:Tamashii.Manager.Connection
|
59
|
+
beat lib/tamashii/manager/client.rb /^ def beat$/;" f language:Ruby class:Tamashii.Manager.Client
|
60
|
+
broadcast lib/tamashii/manager/channel.rb /^ def broadcast(packet, exclude_server = false)$/;" f language:Ruby class:Tamashii.Manager
|
61
|
+
broadcast_all lib/tamashii/manager/channel.rb /^ def broadcast_all(packet)$/;" f language:Ruby class:Tamashii.Manager
|
62
|
+
call lib/tamashii/manager/server.rb /^ def call(env)$/;" f language:Ruby class:Tamashii.Manager.Server
|
63
|
+
call lib/tamashii/manager/server.rb /^ def call(env)$/;" f language:Ruby class:Tamashii.Manager
|
64
|
+
call! lib/tamashii/manager/server.rb /^ def call!(env)$/;" f language:Ruby class:Tamashii.Manager.Server
|
65
|
+
clean_rack_hijack lib/tamashii/manager/stream.rb /^ def clean_rack_hijack$/;" f language:Ruby class:Tamashii.Manager.Stream
|
66
|
+
close lib/tamashii/manager/client.rb /^ def close$/;" f language:Ruby class:Tamashii.Manager.Client
|
67
|
+
close lib/tamashii/manager/stream.rb /^ def close$/;" f language:Ruby class:Tamashii.Manager.Stream
|
68
|
+
compile lib/tamashii/manager/server.rb /^ def compile$/;" f language:Ruby class:Tamashii.Manager.Server
|
69
|
+
config lib/tamashii/manager.rb /^ def self.config(&block)$/;" F language:Ruby class:Tamashii.Manager
|
70
|
+
create! lib/tamashii/manager/channel_pool.rb /^ def create!$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
71
|
+
detach lib/tamashii/manager/stream_event_loop.rb /^ def detach(io, stream)$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
72
|
+
emit_error lib/tamashii/manager/client.rb /^ def emit_error(message)$/;" f language:Ruby class:Tamashii.Manager
|
73
|
+
get lib/tamashii/manager/channel.rb /^ def get(id)$/;" f language:Ruby class:Tamashii.Manager.Channel
|
74
|
+
get_idle lib/tamashii/manager/channel_pool.rb /^ def get_idle$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
75
|
+
heartbeat_callback lib/tamashii/manager/client.rb /^ def heartbeat_callback(beat_time)$/;" f language:Ruby class:Tamashii.Manager
|
76
|
+
id lib/tamashii/manager/client.rb /^ def id$/;" f language:Ruby class:Tamashii.Manager.Client
|
77
|
+
idle lib/tamashii/manager/channel_pool.rb /^ def idle(channel_id = nil)$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
78
|
+
initialize lib/tamashii/manager/authorizator/token.rb /^ def initialize$/;" f language:Ruby class:Tamashii.Manager.Authorizator.Token
|
79
|
+
initialize lib/tamashii/manager/channel.rb /^ def initialize(id, *args)$/;" f language:Ruby class:Tamashii.Manager
|
80
|
+
initialize lib/tamashii/manager/channel_pool.rb /^ def initialize(size = 10)$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
81
|
+
initialize lib/tamashii/manager/client.rb /^ def initialize(env, event_loop)$/;" f language:Ruby class:Tamashii.Manager.Client
|
82
|
+
initialize lib/tamashii/manager/server.rb /^ def initialize$/;" f language:Ruby class:Tamashii.Manager
|
83
|
+
initialize lib/tamashii/manager/stream.rb /^ def initialize(event_loop, io, client)$/;" f language:Ruby class:Tamashii.Manager.Stream
|
84
|
+
initialize lib/tamashii/manager/stream_event_loop.rb /^ def initialize$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
85
|
+
instance lib/tamashii/manager/clients.rb /^ def instance$/;" f language:Ruby class:Tamashii.Manager.Clients
|
86
|
+
instance lib/tamashii/manager/connection.rb /^ def instance$/;" f language:Ruby class:Tamashii.Manager.Connection
|
87
|
+
log_level lib/tamashii/manager/config.rb /^ def log_level(level = nil)$/;" f language:Ruby class:Tamashii.Manager.Config
|
88
|
+
logger lib/tamashii/manager.rb /^ def self.logger$/;" F language:Ruby class:Tamashii.Manager
|
89
|
+
method_missing lib/tamashii/manager/clients.rb /^ def method_missing(name, *args, &block)$/;" f language:Ruby class:Tamashii.Manager.Clients
|
90
|
+
on_close lib/tamashii/manager/client.rb /^ def on_close(e)$/;" f language:Ruby class:Tamashii.Manager
|
91
|
+
on_open lib/tamashii/manager/client.rb /^ def on_open$/;" f language:Ruby class:Tamashii.Manager
|
92
|
+
parse lib/tamashii/manager/client.rb /^ def parse(buffer)$/;" f language:Ruby class:Tamashii.Manager.Client
|
93
|
+
pool lib/tamashii/manager/channel.rb /^ def pool$/;" f language:Ruby class:Tamashii.Manager.Channel
|
94
|
+
post lib/tamashii/manager/stream_event_loop.rb /^ def post(task = nil, &block)$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
95
|
+
ready lib/tamashii/manager/channel_pool.rb /^ def ready(channel)$/;" f language:Ruby class:Tamashii.Manager.ChannelPool
|
96
|
+
receive lib/tamashii/manager/client.rb /^ def receive(data)$/;" f language:Ruby class:Tamashii.Manager
|
97
|
+
receive lib/tamashii/manager/stream.rb /^ def receive(data)$/;" f language:Ruby class:Tamashii.Manager.Stream
|
98
|
+
register lib/tamashii/manager/clients.rb /^ def register(client)$/;" f language:Ruby class:Tamashii.Manager
|
99
|
+
register lib/tamashii/manager/connection.rb /^ def register(client)$/;" f language:Ruby class:Tamashii.Manager.Connection
|
100
|
+
resolve lib/tamashii/manager/authorization.rb /^ def resolve(data = nil)$/;" f language:Ruby class:Tamashii.Manager.Authorization
|
101
|
+
resolve lib/tamashii/manager/handler/broadcaster.rb /^ def resolve(data = nil)$/;" f language:Ruby class:Tamashii.Manager.Handler.Broadcaster
|
102
|
+
run lib/tamashii/manager/stream_event_loop.rb /^ def run$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
103
|
+
select_channel lib/tamashii/manager/channel.rb /^ def select_channel(client)$/;" f language:Ruby class:Tamashii.Manager.Channel
|
104
|
+
send lib/tamashii/manager/client.rb /^ def send(packet)$/;" f language:Ruby class:Tamashii.Manager.Client
|
105
|
+
send_to lib/tamashii/manager/channel.rb /^ def send_to(channel_id, packet)$/;" f language:Ruby class:Tamashii.Manager
|
106
|
+
servers lib/tamashii/manager/channel.rb /^ def servers$/;" f language:Ruby class:Tamashii.Manager.Channel
|
107
|
+
setup_heartbeat_timer lib/tamashii/manager/server.rb /^ def setup_heartbeat_timer$/;" f language:Ruby class:Tamashii.Manager
|
108
|
+
shutdown lib/tamashii/manager/client.rb /^ def shutdown$/;" f language:Ruby class:Tamashii.Manager.Client
|
109
|
+
shutdown lib/tamashii/manager/stream.rb /^ def shutdown$/;" f language:Ruby class:Tamashii.Manager.Stream
|
110
|
+
spawn lib/tamashii/manager/stream_event_loop.rb /^ def spawn$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
111
|
+
stop lib/tamashii/manager/stream_event_loop.rb /^ def stop$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
112
|
+
stopped? lib/tamashii/manager/stream_event_loop.rb /^ def stopped?$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
113
|
+
subscribe lib/tamashii/manager/channel.rb /^ def subscribe(client)$/;" f language:Ruby class:Tamashii.Manager.Channel
|
114
|
+
timer lib/tamashii/manager/stream_event_loop.rb /^ def timer(interval, &block)$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
115
|
+
type lib/tamashii/manager/client.rb /^ def type$/;" f language:Ruby class:Tamashii.Manager.Client
|
116
|
+
unregister lib/tamashii/manager/clients.rb /^ def unregister(client)$/;" f language:Ruby class:Tamashii.Manager
|
117
|
+
unregister lib/tamashii/manager/connection.rb /^ def unregister(client)$/;" f language:Ruby class:Tamashii.Manager.Connection
|
118
|
+
unsubscribe lib/tamashii/manager/channel.rb /^ def unsubscribe(client)$/;" f language:Ruby class:Tamashii.Manager.Channel
|
119
|
+
verify! lib/tamashii/manager/authorizator/token.rb /^ def verify!(data)$/;" f language:Ruby class:Tamashii.Manager.Authorizator.Token
|
120
|
+
wakeup lib/tamashii/manager/stream_event_loop.rb /^ def wakeup$/;" f language:Ruby class:Tamashii.Manager.StreamEventLoop
|
121
|
+
write lib/tamashii/manager/client.rb /^ def write(buffer)$/;" f language:Ruby class:Tamashii.Manager.Client
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tamashii-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: puma
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- lib/tamashii/manager/stream.rb
|
231
231
|
- lib/tamashii/manager/stream_event_loop.rb
|
232
232
|
- lib/tamashii/manager/version.rb
|
233
|
+
- tags
|
233
234
|
- tamashii-manager.gemspec
|
234
235
|
homepage: https://github.com/lctseng/tamashii-manager
|
235
236
|
licenses: []
|
@@ -250,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
251
|
version: '0'
|
251
252
|
requirements: []
|
252
253
|
rubyforge_project:
|
253
|
-
rubygems_version: 2.
|
254
|
+
rubygems_version: 2.6.11
|
254
255
|
signing_key:
|
255
256
|
specification_version: 4
|
256
257
|
summary: The IoT device manager for RubyConf checkin system.
|