Skip to content

Commit d6a5fd0

Browse files
committed
Move failIfInterrupted before storageSession and make it required
Parameter is no longer optional with a default; every caller picks the behaviour explicitly. Updated all 4 store implementations, both CrashableFunctionStore wrappers, InvocationHelper's two call sites (true for user-yield, false for Reschedule), and the remaining test call sites which now pass failIfInterrupted: true to match the prior default semantics.
1 parent fd640a3 commit d6a5fd0

13 files changed

Lines changed: 32 additions & 20 deletions

File tree

Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/DelayedStartUpTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ await store.PostponeFunction(
114114
expectedReplica: ReplicaId.Empty,
115115
effects: null,
116116
messages: null,
117+
failIfInterrupted: true,
117118
storageSession: null
118119
).ShouldBeTrueAsync();
119120

@@ -154,6 +155,7 @@ await store.PostponeFunction(
154155
expectedReplica: ReplicaId.Empty,
155156
effects: null,
156157
messages: null,
158+
failIfInterrupted: true,
157159
storageSession: null
158160
);
159161

Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/ShutdownCoordinationTests/RFunctionsShutdownTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ await store.PostponeFunction(
187187
Guid.Empty.ToReplicaId(),
188188
effects: null,
189189
messages: null,
190+
failIfInterrupted: true,
190191
storageSession: null
191192
).ShouldBeTrueAsync();
192193

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/FunctionTests/PostponedTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ await store.PostponeFunction(
571571
expectedReplica: ReplicaId.Empty,
572572
effects: null,
573573
messages: null,
574+
failIfInterrupted: true,
574575
storageSession: null
575576
).ShouldBeTrueAsync();
576577

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/StoreTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ await store.PostponeFunction(
244244
expectedReplica: ReplicaId.Empty,
245245
effects: null,
246246
messages: null,
247+
failIfInterrupted: true,
247248
storageSession: null
248249
).ShouldBeTrueAsync();
249250

@@ -281,6 +282,7 @@ await store.PostponeFunction(
281282
expectedReplica: ReplicaId.Empty,
282283
effects: null,
283284
messages: null,
285+
failIfInterrupted: true,
284286
storageSession: null
285287
).ShouldBeTrueAsync();
286288

@@ -318,6 +320,7 @@ await store.PostponeFunction(
318320
expectedReplica: ReplicaId.NewId(),
319321
effects: null,
320322
messages: null,
323+
failIfInterrupted: true,
321324
storageSession: null
322325
).ShouldBeFalseAsync();
323326

@@ -859,6 +862,7 @@ await store.PostponeFunction(
859862
expectedReplica: ReplicaId.Empty,
860863
effects: null,
861864
messages: null,
865+
failIfInterrupted: true,
862866
storageSession: null
863867
);
864868

@@ -1390,6 +1394,7 @@ await store.PostponeFunction(
13901394
expectedReplica: ReplicaId.Empty,
13911395
effects: null,
13921396
messages: null,
1397+
failIfInterrupted: true,
13931398
storageSession: null
13941399
).ShouldBeFalseAsync();
13951400

@@ -1431,8 +1436,8 @@ await store.PostponeFunction(
14311436
expectedReplica: ReplicaId.Empty,
14321437
effects: null,
14331438
messages: null,
1434-
storageSession: null,
1435-
failIfInterrupted: false
1439+
failIfInterrupted: false,
1440+
storageSession: null
14361441
).ShouldBeTrueAsync();
14371442

14381443
var sf = await store.GetFunction(storedId).ShouldNotBeNullAsync();
@@ -1902,6 +1907,7 @@ await store.PostponeFunction(
19021907
expectedReplica: ReplicaId.Empty,
19031908
effects: null,
19041909
messages: null,
1910+
failIfInterrupted: true,
19051911
storageSession: null
19061912
).ShouldBeTrueAsync();
19071913

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/WatchDogsTests/CrashableFunctionStore.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ public async Task<bool> PostponeFunction(
131131
ReplicaId expectedReplica,
132132
IReadOnlyList<StoredEffect>? effects,
133133
IReadOnlyList<StoredMessage>? messages,
134-
IStorageSession? storageSession,
135-
bool failIfInterrupted = true
134+
bool failIfInterrupted,
135+
IStorageSession? storageSession
136136
)
137137
{
138138
if (_crashed)
139139
throw new TimeoutException();
140140

141-
var result = await _inner.PostponeFunction(storedId, postponeUntil, timestamp, expectedReplica, effects, messages, storageSession, failIfInterrupted);
141+
var result = await _inner.PostponeFunction(storedId, postponeUntil, timestamp, expectedReplica, effects, messages, failIfInterrupted, storageSession);
142142
AfterPostponeFunctionFlag.Raise();
143143

144144
return result;

Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public async Task<PersistResultOutcome> PersistResult(StoredId storedId, Result<
137137
_replicaId,
138138
effects: null,
139139
messages: null,
140+
failIfInterrupted: true,
140141
storageSession
141142
) ? PersistResultOutcome.Success : PersistResultOutcome.Reschedule;
142143
case Outcome.Fail:
@@ -508,8 +509,8 @@ public async Task<bool> Reschedule(StoredId id, TParam param)
508509
_replicaId,
509510
effects: null,
510511
messages: null,
511-
storageSession: null,
512-
failIfInterrupted: false
512+
failIfInterrupted: false,
513+
storageSession: null
513514
);
514515
}
515516
}

Core/Cleipnir.ResilientFunctions/Storage/IFunctionStore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ Task<bool> PostponeFunction(
7373
ReplicaId expectedReplica,
7474
IReadOnlyList<StoredEffect>? effects,
7575
IReadOnlyList<StoredMessage>? messages,
76-
IStorageSession? storageSession,
77-
bool failIfInterrupted = true
76+
bool failIfInterrupted,
77+
IStorageSession? storageSession
7878
);
7979

8080
Task<bool> FailFunction(

Core/Cleipnir.ResilientFunctions/Storage/InMemoryFunctionStore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ public Task<bool> PostponeFunction(
298298
ReplicaId? expectedReplica,
299299
IReadOnlyList<StoredEffect>? effects,
300300
IReadOnlyList<StoredMessage>? messages,
301-
IStorageSession? storageSession,
302-
bool failIfInterrupted = true)
301+
bool failIfInterrupted,
302+
IStorageSession? storageSession)
303303
{
304304
lock (_sync)
305305
{

Samples/Sample.ConsoleApp/Utils/CrashableFunctionStore.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ public Task<bool> PostponeFunction(
118118
ReplicaId expectedReplica,
119119
IReadOnlyList<StoredEffect>? effects,
120120
IReadOnlyList<StoredMessage>? messages,
121-
IStorageSession? storageSession,
122-
bool failIfInterrupted = true
121+
bool failIfInterrupted,
122+
IStorageSession? storageSession
123123
) => _crashed
124124
? Task.FromException<bool>(new TimeoutException())
125-
: _inner.PostponeFunction(storedId, postponeUntil, timestamp, expectedReplica, effects, messages, storageSession, failIfInterrupted);
125+
: _inner.PostponeFunction(storedId, postponeUntil, timestamp, expectedReplica, effects, messages, failIfInterrupted, storageSession);
126126

127127
public Task<bool> FailFunction(
128128
StoredId storedId,

Stores/MariaDB/Cleipnir.ResilientFunctions.MariaDB/MariaDbFunctionStore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ public async Task<bool> PostponeFunction(
509509
ReplicaId expectedReplica,
510510
IReadOnlyList<StoredEffect>? effects,
511511
IReadOnlyList<StoredMessage>? messages,
512-
IStorageSession? storageSession,
513-
bool failIfInterrupted = true)
512+
bool failIfInterrupted,
513+
IStorageSession? storageSession)
514514
{
515515
byte[]? effectsBytes = null;
516516
if (storageSession is SnapshotStorageSession session && session.Effects.Count > 0)

0 commit comments

Comments
 (0)