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 +4 -4
- data/Cargo.lock +1 -1
- data/ext/restate_internal/Cargo.toml +1 -1
- data/lib/restate/durable_future.rb +13 -0
- data/lib/restate/errors.rb +12 -0
- data/lib/restate/version.rb +1 -1
- data/sig/restate.rbs +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98226ceeedf91fa42bbafa435efad5ee72571bea81cd7684a3e8726efafc049d
|
|
4
|
+
data.tar.gz: 87520432eed026201b420da367ecf89bb56d3ced49aa0de243ac6610f8cbd584
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: babf39022a0c123d246623a174afa5af2f56a6e552f6de2299b74fbe8845a98396a12842a818e91fb04a707f6a26054c28dace700362a6bf9ea0b89fe958dcab
|
|
7
|
+
data.tar.gz: 441dd64b8d55779837a3a819d9c30908fbfcff5c17c67db6f89dfd3906d4f7857e12347dcea860bb911c1ca3d617ab2292281a69a1124947e32740a04335948e
|
data/Cargo.lock
CHANGED
|
@@ -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.
|
data/lib/restate/errors.rb
CHANGED
|
@@ -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
|
data/lib/restate/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2026-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async
|