restate-sdk 0.13.0 → 0.14.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: 3ce15bde18d1b56824de0e89d3b01a2a8df327c0adf454c922d72bef60a9afae
4
- data.tar.gz: 9ceb40425d0be8ffb705e8639a7dc911791c5e77de56965f8b9214b640c7a6e6
3
+ metadata.gz: 98226ceeedf91fa42bbafa435efad5ee72571bea81cd7684a3e8726efafc049d
4
+ data.tar.gz: 87520432eed026201b420da367ecf89bb56d3ced49aa0de243ac6610f8cbd584
5
5
  SHA512:
6
- metadata.gz: edd0c0a9a4dd9df432ca4ee736f96f96daaee2e5485437968b43c9f10de6f1acc7dea1510d2e96436d49a25045f4ef83819fbac09388a1f80dba317d86f157dd
7
- data.tar.gz: d94297953c904448104d9b033d9eafabdc63e75f605235aedb31501070ce3b528a590ac1ab7186e4044d6f385039404c6bfbaf8d6c34a0af2d718d5a9efe0029
6
+ metadata.gz: babf39022a0c123d246623a174afa5af2f56a6e552f6de2299b74fbe8845a98396a12842a818e91fb04a707f6a26054c28dace700362a6bf9ea0b89fe958dcab
7
+ data.tar.gz: 441dd64b8d55779837a3a819d9c30908fbfcff5c17c67db6f89dfd3906d4f7857e12347dcea860bb911c1ca3d617ab2292281a69a1124947e32740a04335948e
data/Cargo.lock CHANGED
@@ -561,7 +561,7 @@ dependencies = [
561
561
 
562
562
  [[package]]
563
563
  name = "restate_internal"
564
- version = "0.13.0"
564
+ version = "0.14.0"
565
565
  dependencies = [
566
566
  "magnus",
567
567
  "rb-sys",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "restate_internal"
3
- version = "0.13.0"
3
+ version = "0.14.0"
4
4
  edition = "2021"
5
5
  publish = false
6
6
 
@@ -33,6 +33,19 @@ module Restate
33
33
  def completed?
34
34
  @resolved || @ctx.completed?(@handle)
35
35
  end
36
+
37
+ # Race +self+ against +Restate.sleep(duration)+. Returns the value
38
+ # if the future wins; raises {Restate::TimeoutError} otherwise.
39
+ # Does not cancel the underlying work (matches TS/Java SDKs); on
40
+ # a {DurableCallFuture}, call +#cancel+ in the rescue if you want
41
+ # the remote invocation stopped.
42
+ def or_timeout(duration)
43
+ sleep_future = Restate.sleep(duration)
44
+ Restate.wait_any(self, sleep_future)
45
+ return await if completed?
46
+
47
+ raise TimeoutError
48
+ end
36
49
  end
37
50
 
38
51
  # A durable future for service/object/workflow calls.
@@ -17,6 +17,18 @@ module Restate
17
17
  end
18
18
  end
19
19
 
20
+ # Raised by {DurableFuture#or_timeout} when the timeout elapses
21
+ # before the future completes. Mirrors +TimeoutError+ in the
22
+ # TypeScript SDK (408 Request Timeout) and +TimeoutException+ in
23
+ # the Java SDK. Inherits from {TerminalError} so the same
24
+ # +rescue Restate::TerminalError+ block in user handlers catches
25
+ # timeouts alongside other terminal failures.
26
+ class TimeoutError < TerminalError
27
+ def initialize(message = 'Timeout occurred', metadata: nil)
28
+ super(message, status_code: 408, metadata: metadata)
29
+ end
30
+ end
31
+
20
32
  # Internal: raised when the VM suspends execution.
21
33
  # User code should NOT catch this.
22
34
  class SuspendedError < StandardError
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Restate
5
- VERSION = '0.13.0'
5
+ VERSION = '0.14.0'
6
6
  end
data/sig/restate.rbs CHANGED
@@ -73,6 +73,10 @@ module Restate
73
73
  def initialize: (?String message, ?status_code: Integer, ?metadata: Hash[String, String]?) -> void
74
74
  end
75
75
 
76
+ class TimeoutError < TerminalError
77
+ def initialize: (?String message, ?metadata: Hash[String, String]?) -> void
78
+ end
79
+
76
80
  class SuspendedError < StandardError
77
81
  def initialize: () -> void
78
82
  end
@@ -92,6 +96,7 @@ module Restate
92
96
  def initialize: (untyped ctx, Integer handle, ?serde: untyped) -> void
93
97
  def await: () -> untyped
94
98
  def completed?: () -> bool
99
+ def or_timeout: (Numeric duration) -> untyped
95
100
  end
96
101
 
97
102
  class DurableCallFuture < DurableFuture
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restate-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Restate Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-15 00:00:00.000000000 Z
11
+ date: 2026-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async