Skip to content

Commit 72e640d

Browse files
Spotless apply
1 parent 53d38fa commit 72e640d

File tree

3 files changed

+73
-86
lines changed

3 files changed

+73
-86
lines changed

examples/src/main/kotlin/my/restate/sdk/examples/CounterKt.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import dev.restate.sdk.kotlin.endpoint.*
1717
import kotlinx.serialization.Serializable
1818
import org.apache.logging.log4j.LogManager
1919
import org.apache.logging.log4j.Logger
20-
import kotlin.time.Duration.Companion.seconds
2120

2221
@VirtualObject
2322
class CounterKt {
@@ -58,10 +57,6 @@ class CounterKt {
5857
}
5958

6059
fun main() {
61-
val endpoint = endpoint {
62-
bind(CounterKt()) {
63-
it.abortTimeout = 30.seconds
64-
}
65-
}
60+
val endpoint = endpoint { bind(CounterKt()) }
6661
RestateHttpServer.listen(endpoint)
6762
}

sdk-api-kotlin/src/main/kotlin/dev/restate/sdk/kotlin/endpoint/endpoint.kt

Lines changed: 70 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ fun endpoint(init: Endpoint.Builder.() -> Unit): Endpoint {
2323
}
2424

2525
/**
26-
* Documentation as shown in the UI, Admin REST API, and the generated OpenAPI documentation of
27-
* this service.
26+
* Documentation as shown in the UI, Admin REST API, and the generated OpenAPI documentation of this
27+
* service.
2828
*/
2929
var ServiceDefinition.Configurator.documentation: String?
3030
get() {
3131
return this.documentation()
3232
}
3333
set(value) {
34-
this.documentation (value)
34+
this.documentation(value)
3535
}
3636

37-
/**
38-
* Service metadata, as propagated in the Admin REST API.
39-
*/
37+
/** Service metadata, as propagated in the Admin REST API. */
4038
var ServiceDefinition.Configurator.metadata: Map<String, String>?
4139
get() {
4240
return this.metadata()
@@ -49,69 +47,68 @@ var ServiceDefinition.Configurator.metadata: Map<String, String>?
4947
* This timer guards against stalled invocations. Once it expires, Restate triggers a graceful
5048
* termination by asking the invocation to suspend (which preserves intermediate progress).
5149
*
52-
* The [abortTimeout] is used to abort the invocation, in case it doesn't
53-
* react to the request to suspend.
50+
* The [abortTimeout] is used to abort the invocation, in case it doesn't react to the request to
51+
* suspend.
5452
*
5553
* This overrides the default inactivity timeout configured in the restate-server for all
5654
* invocations to this service.
5755
*
58-
* *NOTE:* You can set this field only if you register this service against
59-
* restate-server >= 1.4, otherwise the service discovery will fail.
56+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
57+
* otherwise the service discovery will fail.
6058
*/
6159
var ServiceDefinition.Configurator.inactivityTimeout: Duration?
6260
get() {
6361
return this.inactivityTimeout()?.toKotlinDuration()
6462
}
6563
set(value) {
66-
this.inactivityTimeout (value?.toJavaDuration())
64+
this.inactivityTimeout(value?.toJavaDuration())
6765
}
6866

6967
/**
70-
* This timer guards against stalled service/handler invocations that are supposed to terminate.
71-
* The abort timeout is started after the [inactivityTimeout] has expired and
72-
* the service/handler invocation has been asked to gracefully terminate. Once the timer
73-
* expires, it will abort the service/handler invocation.
68+
* This timer guards against stalled service/handler invocations that are supposed to terminate. The
69+
* abort timeout is started after the [inactivityTimeout] has expired and the service/handler
70+
* invocation has been asked to gracefully terminate. Once the timer expires, it will abort the
71+
* service/handler invocation.
7472
*
75-
* This timer potentially *interrupts* user code. If the user code needs longer to
76-
* gracefully terminate, then this value needs to be set accordingly.
73+
* This timer potentially *interrupts* user code. If the user code needs longer to gracefully
74+
* terminate, then this value needs to be set accordingly.
7775
*
78-
* This overrides the default abort timeout configured in the restate-server for all
79-
* invocations to this service.
76+
* This overrides the default abort timeout configured in the restate-server for all invocations to
77+
* this service.
8078
*
81-
* *NOTE:* You can set this field only if you register this service against
82-
* restate-server >= 1.4, otherwise the service discovery will fail.
79+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
80+
* otherwise the service discovery will fail.
8381
*/
8482
var ServiceDefinition.Configurator.abortTimeout: Duration?
8583
get() {
8684
return this.abortTimeout()?.toKotlinDuration()
8785
}
8886
set(value) {
89-
this.abortTimeout( value?.toJavaDuration())
87+
this.abortTimeout(value?.toJavaDuration())
9088
}
9189

9290
/**
9391
* The retention duration of idempotent requests to this service.
9492
*
95-
* *NOTE:* You can set this field only if you register this service against
96-
* restate-server >= 1.4, otherwise the service discovery will fail.
93+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
94+
* otherwise the service discovery will fail.
9795
*/
9896
var ServiceDefinition.Configurator.idempotencyRetention: Duration?
9997
get() {
10098
return this.idempotencyRetention()?.toKotlinDuration()
10199
}
102100
set(value) {
103-
this.idempotencyRetention (value?.toJavaDuration())
101+
this.idempotencyRetention(value?.toJavaDuration())
104102
}
105103

106104
/**
107-
* The journal retention. When set, this applies to all requests to all handlers of this
108-
* service.
105+
* The journal retention. When set, this applies to all requests to all handlers of this service.
109106
*
110-
* In case the request has an idempotency key, the [idempotencyRetention]
111-
* caps the journal retention time.
107+
* In case the request has an idempotency key, the [idempotencyRetention] caps the journal retention
108+
* time.
112109
*
113-
* *NOTE:* You can set this field only if you register this service against
114-
* restate-server >= 1.4, otherwise the service discovery will fail.
110+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
111+
* otherwise the service discovery will fail.
115112
*
116113
* @return this
117114
*/
@@ -120,15 +117,15 @@ var ServiceDefinition.Configurator.journalRetention: Duration?
120117
return this.journalRetention()?.toKotlinDuration()
121118
}
122119
set(value) {
123-
this.journalRetention ( value?.toJavaDuration())
120+
this.journalRetention(value?.toJavaDuration())
124121
}
125122

126123
/**
127-
* When set to `true`, lazy state will be enabled for all invocations to this service.
128-
* This is relevant only for workflows and virtual objects.
124+
* When set to `true`, lazy state will be enabled for all invocations to this service. This is
125+
* relevant only for workflows and virtual objects.
129126
*
130-
* *NOTE:* You can set this field only if you register this service against
131-
* restate-server >= 1.4, otherwise the service discovery will fail.
127+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
128+
* otherwise the service discovery will fail.
132129
*/
133130
var ServiceDefinition.Configurator.enableLazyState: Boolean?
134131
get() {
@@ -139,18 +136,18 @@ var ServiceDefinition.Configurator.enableLazyState: Boolean?
139136
}
140137

141138
/**
142-
* When set to `true` this service, with all its handlers, cannot be invoked from the
143-
* restate-server HTTP and Kafka ingress, but only from other services.
139+
* When set to `true` this service, with all its handlers, cannot be invoked from the restate-server
140+
* HTTP and Kafka ingress, but only from other services.
144141
*
145-
* *NOTE:* You can set this field only if you register this service against
146-
* restate-server >= 1.4, otherwise the service discovery will fail.
142+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
143+
* otherwise the service discovery will fail.
147144
*/
148145
var ServiceDefinition.Configurator.ingressPrivate: Boolean?
149146
get() {
150147
return this.ingressPrivate()
151148
}
152149
set(value) {
153-
this.ingressPrivate (value)
150+
this.ingressPrivate(value)
154151
}
155152

156153
/**
@@ -166,8 +163,8 @@ var HandlerDefinition.Configurator.acceptContentType: String?
166163
}
167164

168165
/**
169-
* Documentation as shown in the UI, Admin REST API, and the generated OpenAPI documentation of
170-
* this handler.
166+
* Documentation as shown in the UI, Admin REST API, and the generated OpenAPI documentation of this
167+
* handler.
171168
*/
172169
var HandlerDefinition.Configurator.documentation: String?
173170
get() {
@@ -177,9 +174,7 @@ var HandlerDefinition.Configurator.documentation: String?
177174
this.documentation(value)
178175
}
179176

180-
/**
181-
* Handler metadata, as propagated in the Admin REST API.
182-
*/
177+
/** Handler metadata, as propagated in the Admin REST API. */
183178
var HandlerDefinition.Configurator.metadata: Map<String, String>?
184179
get() {
185180
return this.metadata()
@@ -192,14 +187,13 @@ var HandlerDefinition.Configurator.metadata: Map<String, String>?
192187
* This timer guards against stalled invocations. Once it expires, Restate triggers a graceful
193188
* termination by asking the invocation to suspend (which preserves intermediate progress).
194189
*
195-
* The [abortTimeout] is used to abort the invocation, in case it doesn't
196-
* react to the request to suspend.
190+
* The [abortTimeout] is used to abort the invocation, in case it doesn't react to the request to
191+
* suspend.
197192
*
198-
* This overrides the inactivity timeout set for the service and the default set in
199-
* restate-server.
193+
* This overrides the inactivity timeout set for the service and the default set in restate-server.
200194
*
201-
* *NOTE:* You can set this field only if you register this service against
202-
* restate-server >= 1.4, otherwise the service discovery will fail.
195+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
196+
* otherwise the service discovery will fail.
203197
*/
204198
var HandlerDefinition.Configurator.inactivityTimeout: Duration?
205199
get() {
@@ -210,19 +204,17 @@ var HandlerDefinition.Configurator.inactivityTimeout: Duration?
210204
}
211205

212206
/**
213-
* This timer guards against stalled invocations that are supposed to terminate. The abort
214-
* timeout is started after the [inactivityTimeout] has expired and the
215-
* invocation has been asked to gracefully terminate. Once the timer expires, it will abort the
216-
* invocation.
207+
* This timer guards against stalled invocations that are supposed to terminate. The abort timeout
208+
* is started after the [inactivityTimeout] has expired and the invocation has been asked to
209+
* gracefully terminate. Once the timer expires, it will abort the invocation.
217210
*
218-
* This timer potentially *interrupts* user code. If the user code needs longer to
219-
* gracefully terminate, then this value needs to be set accordingly.
211+
* This timer potentially *interrupts* user code. If the user code needs longer to gracefully
212+
* terminate, then this value needs to be set accordingly.
220213
*
221-
* This overrides the abort timeout set for the service and the default set in
222-
* restate-server.
214+
* This overrides the abort timeout set for the service and the default set in restate-server.
223215
*
224-
* *NOTE:* You can set this field only if you register this service against
225-
* restate-server >= 1.4, otherwise the service discovery will fail.
216+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
217+
* otherwise the service discovery will fail.
226218
*/
227219
var HandlerDefinition.Configurator.abortTimeout: Duration?
228220
get() {
@@ -235,8 +227,8 @@ var HandlerDefinition.Configurator.abortTimeout: Duration?
235227
/**
236228
* The retention duration of idempotent requests to this service.
237229
*
238-
* *NOTE:* You can set this field only if you register this service against
239-
* restate-server >= 1.4, otherwise the service discovery will fail.
230+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
231+
* otherwise the service discovery will fail.
240232
*/
241233
var HandlerDefinition.Configurator.idempotencyRetention: Duration?
242234
get() {
@@ -249,8 +241,8 @@ var HandlerDefinition.Configurator.idempotencyRetention: Duration?
249241
/**
250242
* The retention duration for this workflow handler.
251243
*
252-
* *NOTE:* You can set this field only if you register this service against
253-
* restate-server >= 1.4, otherwise the service discovery will fail.
244+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
245+
* otherwise the service discovery will fail.
254246
*/
255247
var HandlerDefinition.Configurator.workflowRetention: Duration?
256248
get() {
@@ -263,11 +255,11 @@ var HandlerDefinition.Configurator.workflowRetention: Duration?
263255
/**
264256
* The journal retention for invocations to this handler.
265257
*
266-
* In case the request has an idempotency key, the [idempotencyRetention]
267-
* caps the journal retention time.
258+
* In case the request has an idempotency key, the [idempotencyRetention] caps the journal retention
259+
* time.
268260
*
269-
* *NOTE:* You can set this field only if you register this service against
270-
* restate-server >= 1.4, otherwise the service discovery will fail.
261+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
262+
* otherwise the service discovery will fail.
271263
*/
272264
var HandlerDefinition.Configurator.journalRetention: Duration?
273265
get() {
@@ -278,11 +270,11 @@ var HandlerDefinition.Configurator.journalRetention: Duration?
278270
}
279271

280272
/**
281-
* When set to `true` this handler cannot be invoked from the restate-server HTTP and
282-
* Kafka ingress, but only from other services.
273+
* When set to `true` this handler cannot be invoked from the restate-server HTTP and Kafka ingress,
274+
* but only from other services.
283275
*
284-
* *NOTE:* You can set this field only if you register this service against
285-
* restate-server >= 1.4, otherwise the service discovery will fail.
276+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
277+
* otherwise the service discovery will fail.
286278
*/
287279
var HandlerDefinition.Configurator.ingressPrivate: Boolean?
288280
get() {
@@ -293,11 +285,11 @@ var HandlerDefinition.Configurator.ingressPrivate: Boolean?
293285
}
294286

295287
/**
296-
* When set to `true`, lazy state will be enabled for all invocations to this handler.
297-
* This is relevant only for workflows and virtual objects.
288+
* When set to `true`, lazy state will be enabled for all invocations to this handler. This is
289+
* relevant only for workflows and virtual objects.
298290
*
299-
* *NOTE:* You can set this field only if you register this service against
300-
* restate-server >= 1.4, otherwise the service discovery will fail.
291+
* *NOTE:* You can set this field only if you register this service against restate-server >= 1.4,
292+
* otherwise the service discovery will fail.
301293
*/
302294
var HandlerDefinition.Configurator.enableLazyState: Boolean?
303295
get() {

sdk-common/src/main/java/dev/restate/sdk/endpoint/definition/HandlerDefinition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public Configurator abortTimeout(@Nullable Duration abortTimeout) {
457457
public Configurator idempotencyRetention(@Nullable Duration idempotencyRetention) {
458458
if (handlerType == HandlerType.WORKFLOW) {
459459
throw new IllegalArgumentException(
460-
"The idempotency retention cannot be set for workflow handlers. Use workflowRetention(Duration) instead");
460+
"The idempotency retention cannot be set for workflow handlers. Use workflowRetention(Duration) instead");
461461
}
462462
this.idempotencyRetention = idempotencyRetention;
463463
return this;
@@ -482,7 +482,7 @@ public Configurator idempotencyRetention(@Nullable Duration idempotencyRetention
482482
public Configurator workflowRetention(@Nullable Duration workflowRetention) {
483483
if (handlerType != HandlerType.WORKFLOW) {
484484
throw new IllegalArgumentException(
485-
"Workflow retention can be set only for workflow handlers");
485+
"Workflow retention can be set only for workflow handlers");
486486
}
487487
this.workflowRetention = workflowRetention;
488488
return this;

0 commit comments

Comments
 (0)