cuboid 0.1.5 → 0.1.7

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
  SHA256:
3
- metadata.gz: 5b9121b12ad9684342c07f1f103a7ceccaf7a5fc4726aff0f869c004eb0609c6
4
- data.tar.gz: 8bc40ef564aa932c948acb929e9ebd41e97fe3f684326db9a13095fc321a9049
3
+ metadata.gz: 278074cb43a3bbbe9c868f6fa73f4be09b0c61456a791c9b8e4d6976663ebcce
4
+ data.tar.gz: 0b49b4aa13bff9232c8b58a9dd828b9f71a42107279e5d3fb3b7188deb2a1c23
5
5
  SHA512:
6
- metadata.gz: 803d5ae299c9af535d49172cb9dcf1c4d91567d40a0a6e981223f3fb7de7a16869449d30d9f2f81de01f35ae2e6ee9c1e40d7f517c9781ae3c29a82c9f070c2c
7
- data.tar.gz: fdb7bb6c4fa8c9bb97338d78f6e53671789aa1c1624653bab2794754cbcade7c6a915a1c5a39bbbaab983a182a4d220d82ee36cfe8037271ed2eacf514f8e420
6
+ metadata.gz: 6fbc63babfbfd8a79ecec9c9833c24405776cfbd35bb087ab9d765fbc153907e48ae183c000b7ae8a96ba9ae0152b7c3037fe5814d8c40528963279e1be9eeee
7
+ data.tar.gz: b4a8d35eadb8b454c655f325eb3b16cb6cdaf4f398f41bab88435023cece7bf842d3ad48fa5fe9c8ca73ccc6f782663cce81b0ea07e6353189d027f9ef5d9127
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.1.7
2
+
3
+ * `Application`
4
+ * Added `#shutdown` callback method to handle RPC server shutdowns.
5
+
6
+ # 0.1.6.1
7
+
8
+ * `OptionGroups::RPC`: Added `#url`.
9
+
1
10
  # 0.1.5
2
11
 
3
12
  * Fixed relative path for application source path detection.
@@ -67,6 +67,10 @@ class Application
67
67
  true
68
68
  end
69
69
 
70
+ def shutdown
71
+ super if defined? super
72
+ end
73
+
70
74
  private
71
75
 
72
76
  # @note Must be called before calling any audit methods.
@@ -79,6 +79,10 @@ class RPC < Cuboid::OptionGroup
79
79
  server_port: 7331
80
80
  )
81
81
 
82
+ def url
83
+ "#{server_address}:#{server_port}"
84
+ end
85
+
82
86
  def to_client_options
83
87
  {
84
88
  connection_pool_size: connection_pool_size,
@@ -19,7 +19,7 @@ class ApplicationWrapper
19
19
  def_delegators :@application, :suspended?, :suspending?, :suspend!, :status,
20
20
  :pause!, :running?, :status_messages, :paused?, :pausing?,
21
21
  :snapshot_path, :restore!, :resume!, :generate_report,
22
- :abort!, :aborting?, :aborted?
22
+ :abort!, :aborting?, :aborted?, :shutdown
23
23
 
24
24
  # {RPC::Server::Application} error namespace.
25
25
  #
@@ -102,7 +102,10 @@ class Instance
102
102
  # @see #suspend
103
103
  # @see #snapshot_path
104
104
  def restore!( snapshot )
105
- @application.restore!( snapshot ).run
105
+ Thread.new do
106
+ @application.restore!( snapshot ).run
107
+ end
108
+
106
109
  true
107
110
  end
108
111
 
@@ -123,7 +126,7 @@ class Instance
123
126
  #
124
127
  # @see #report
125
128
  def abort_and_generate_report
126
- @application.clean_up
129
+ @application.abort!
127
130
  generate_report
128
131
  end
129
132
 
@@ -205,8 +208,10 @@ class Instance
205
208
 
206
209
  @active_options.set( application: options )
207
210
 
208
- @application.run
209
- @run_initializing = false
211
+ Thread.new do
212
+ @application.run
213
+ @run_initializing = false
214
+ end
210
215
 
211
216
  true
212
217
  end
@@ -221,6 +226,8 @@ class Instance
221
226
 
222
227
  print_status 'Shutting down...'
223
228
 
229
+ @application.shutdown
230
+
224
231
  # We're shutting down services so we need to use a concurrent way but
225
232
  # without going through the Reactor.
226
233
  Thread.new do
@@ -110,10 +110,6 @@ class Application
110
110
  @status == :timed_out
111
111
  end
112
112
 
113
- # @param [Bool] block
114
- # `true` if the method should block until an abortion has completed,
115
- # `false` otherwise.
116
- #
117
113
  # @return [Bool]
118
114
  # `true` if the abort request was successful, `false` if the system is
119
115
  # already {#suspended?} or is {#suspending?}.
data/lib/version CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.7
@@ -111,8 +111,6 @@ describe 'Cuboid::RPC::Server::Instance' do
111
111
  subject = instance_spawn
112
112
  subject.restore! snapshot_path
113
113
 
114
- File.delete snapshot_path
115
-
116
114
  sleep 1 while subject.status != :done
117
115
 
118
116
  expect(subject.generate_report.options).to eq(options)
@@ -204,6 +202,8 @@ describe 'Cuboid::RPC::Server::Instance' do
204
202
 
205
203
  describe '#abort_and_generate_report' do
206
204
  it "cleans-up and returns the report as #{Cuboid::Report}" do
205
+ subject.run
206
+
207
207
  expect(subject.abort_and_generate_report).to be_kind_of Cuboid::Report
208
208
  end
209
209
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuboid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tasos Laskos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-12 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print