Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions Core/Cleipnir.ResilientFunctions/Storage/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,30 +195,4 @@ public static Task<Type> ResolveResultType(this StoredEffect effect, TypeMapper
=> typeMapper.ResolveType(effect.ResultType!.Value);
}

public record StoredReplica(ReplicaId ReplicaId, long LatestHeartbeat);

public record StoredInputOutput(
StoredId Id,
byte[]? ParamJson,
byte[]? ResultJson,
string? ExceptionJson,
string HumanInstanceId,
StoredId? Parent
)
{
public StoredFlow ToStoredFlow(Status status, long expires, long timestamp, ReplicaId owner)
{
return new StoredFlow(
Id,
HumanInstanceId,
ParamJson,
status,
ExceptionJson != null ? StoredException.Deserialize(ExceptionJson) : null,
expires,
timestamp,
Parent,
owner,
Id.Type
);
}
};
public record StoredReplica(ReplicaId ReplicaId, long LatestHeartbeat);
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,6 @@ namespace Cleipnir.ResilientFunctions.PostgreSQL;

public class SqlGenerator(string tablePrefix)
{
public async Task<StoredInputOutput?> ReadStoredFunction(NpgsqlDataReader reader)
{
/*
0 id
1 param
2 result
3 exception
4 human_instance_id
5 parent
*/
while (await reader.ReadAsync())
{
var id = reader.GetGuid(0).ToStoredId();
var hasParam = !await reader.IsDBNullAsync(1);
var hasResult = !await reader.IsDBNullAsync(2);
var hasException = !await reader.IsDBNullAsync(3);
var hasParent = !await reader.IsDBNullAsync(5);

var paramJson = hasParam ? (byte[])reader.GetValue(1) : null;
var resultJson = hasResult ? (byte[])reader.GetValue(2) : null;
var exceptionJson = hasException ? reader.GetString(3) : null;
var humanInstanceId = reader.GetString(4);
var parent = hasParent ? reader.GetGuid(5).ToStoredId() : null;

return new StoredInputOutput(id, paramJson, resultJson, exceptionJson, humanInstanceId, parent);
}

return null;
}
public StoreCommand InsertEffects(StoredId storedId, IReadOnlyList<StoredEffectChange> changes, SnapshotStorageSession session)
{
foreach (var change in changes)
Expand Down