volcano-sdk 0.10.3 → 0.11.0

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: f19fcadb6b2a2cd4e84d10cba5605c45dadfb20ebdfe62fe3a4b3dd352bc0dc1
4
- data.tar.gz: 276e7c559b704d8c9ef911fccfe009f9ec0f09e3ba3c3bae3854b2332f17dcaa
3
+ metadata.gz: bf2a0caee1957ed46788be12d4d4e7afd2f0b890d5aa30a4da7ab5db3879dc38
4
+ data.tar.gz: 8bd82526f9a4c44cdba5fe7c3fb503f6de17a0b8a5feacf9b6855f3afc21a20d
5
5
  SHA512:
6
- metadata.gz: ec93b1ef716dbcf52f45b6d4a81fa4fa6b1e00c26efc47d59e9a1ab41db89fdb6f892a2db422c99155760a99757de8a2142d9dc17a185b2f29375d0612107c12
7
- data.tar.gz: aa3c752a3d0b2e2f8bb3cba8ffe185f3c5f3597aadb2d6049d7952a827af40ad3f37ff90f4db2b15acc4a106c84d945ceec126add281aaa3861702e9ce59c8c5
6
+ metadata.gz: 2b3f3399f7af7742c6bbdd309b9634706b1490418ce109f5611c29b2d456a884329934ee9ef6336330bd18e1f3f3a925ac7c6d2b64ac3a2cc933f9037715f1af
7
+ data.tar.gz: 22594c1363baa348fd2d8b15cfcd24de6335c6d69c1a50d11139190ebb80d7b87897bb51bae0a388c8322fff64bf6585bf722f049c512eefaad6bcacc36d6e8b
@@ -117,19 +117,17 @@ module Volcano
117
117
  )
118
118
  end
119
119
 
120
- # An empty page carries no executions at all rather than an empty array.
121
120
  def page_payload(payload)
122
121
  raise TypeError, INCOMPLETE_PAGE unless payload.is_a?(Hash)
123
122
 
124
- data = payload['data'] || []
125
- has_more = payload.fetch('has_more', false)
123
+ data = payload['data']
124
+ has_more = payload['has_more']
126
125
  raise TypeError, INCOMPLETE_PAGE unless data.is_a?(Array) && [true, false].include?(has_more)
127
126
 
128
127
  [data, has_more]
129
128
  end
130
129
 
131
130
  def count(value)
132
- return 0 if value.nil?
133
131
  raise TypeError, INCOMPLETE_PAGE unless value.is_a?(Integer)
134
132
 
135
133
  value
@@ -120,7 +120,7 @@ module Volcano
120
120
  end
121
121
 
122
122
  def cache_ttl(payload)
123
- ttl = payload['cache_ttl_seconds'] if payload.is_a?(Hash)
123
+ ttl = payload['cache_ttl_seconds']
124
124
  raise TypeError, 'Expected a complete function response' unless ttl.is_a?(Integer) && ttl.positive?
125
125
 
126
126
  ttl
@@ -31,7 +31,7 @@ module Volcano
31
31
  invoke do
32
32
  apis = @api_factory.call(authorization)
33
33
  data, status, headers = apis.durable.list_durable_executions_with_http_info(
34
- project_id, function_id, options
34
+ project_id, function_id, options.merge(debug_return_type: 'Object')
35
35
  )
36
36
  response(data, status, headers)
37
37
  end
@@ -30,17 +30,15 @@ module Volcano
30
30
  LockRenewer.new(self, key, guard, config)
31
31
  end
32
32
 
33
- def renewal_delay(ttl, remaining: nil)
33
+ def renewal_delay(ttl, remaining:)
34
34
  delay = [ttl / 3.0, MAX_RENEWAL_DELAY_SECONDS].min
35
35
  latest = latest_renewal_delay(remaining)
36
- delay = [delay, latest].min if latest
36
+ delay = [delay, latest].min
37
37
  jittered = [0.0, delay * (0.9 + (rand * 0.2))].max
38
- latest ? [jittered, latest].min : jittered
38
+ [jittered, latest].min
39
39
  end
40
40
 
41
41
  def latest_renewal_delay(remaining)
42
- return unless remaining
43
-
44
42
  [0.0, remaining - RENEWAL_SAFETY_MARGIN_SECONDS - RENEWAL_REQUEST_BUDGET_SECONDS].max
45
43
  end
46
44
 
@@ -19,7 +19,7 @@ module Volcano
19
19
  rescue StandardError => e
20
20
  raise Redaction.exception(e, secrets: @secrets), cause: nil
21
21
  ensure
22
- @pending.delete(id) if defined?(id)
22
+ @pending.delete(id)
23
23
  end
24
24
 
25
25
  def register_request(reply_key, on_reply)
@@ -43,8 +43,6 @@ module Volcano
43
43
  end
44
44
 
45
45
  def reject_invalid_publication(channel, publication)
46
- return unless channel
47
-
48
46
  if publication.is_a?(Hash)
49
47
  drop_publication(channel, publication)
50
48
  else
@@ -54,7 +52,7 @@ module Volcano
54
52
  end
55
53
 
56
54
  def drop_handlerless_publication(channel, publication)
57
- drop_publication(channel, publication) if channel
55
+ drop_publication(channel, publication)
58
56
  nil
59
57
  end
60
58
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Volcano
4
- VERSION = '0.10.3'
4
+ VERSION = '0.11.0'
5
5
  end
data/sig/errors.rbs ADDED
@@ -0,0 +1,36 @@
1
+ module Volcano
2
+ module Error
3
+ class VolcanoError < StandardError
4
+ attr_reader status: Integer?
5
+ attr_reader code: String?
6
+ attr_reader retry_after: Integer?
7
+
8
+ def initialize: (String? message, ?status: Integer?, ?code: String?, ?retry_after: Integer?) -> void
9
+ end
10
+
11
+ class AuthenticationError < VolcanoError
12
+ end
13
+
14
+ class ValidationError < VolcanoError
15
+ end
16
+
17
+ class NotFoundError < VolcanoError
18
+ end
19
+
20
+ class ConflictError < VolcanoError
21
+ end
22
+
23
+ class SessionChangedError < ConflictError
24
+ def initialize: (?String? message, ?status: Integer?, ?code: String?, ?retry_after: Integer?) -> void
25
+ end
26
+
27
+ class RateLimitedError < VolcanoError
28
+ end
29
+
30
+ class ServerError < VolcanoError
31
+ end
32
+
33
+ class TransportError < VolcanoError
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volcano-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kong
@@ -603,6 +603,7 @@ files:
603
603
  - lib/volcano/transport.rb
604
604
  - lib/volcano/user.rb
605
605
  - lib/volcano/version.rb
606
+ - sig/errors.rbs
606
607
  homepage: https://github.com/Kong/volcano-sdk-ruby
607
608
  licenses:
608
609
  - Apache-2.0