Skip to content

Commit

Permalink
#813 refactoring TParams tState
Browse files Browse the repository at this point in the history
  • Loading branch information
zhabis committed Jan 26, 2023
1 parent a0e5d7c commit 0374685
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Azos.Sky.Server/Fabric/Server/FiberProcessorDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,17 @@ private void reportUnknownImage(Guid guid)
pars: new{ imageTypeId = guid }.ToJson() );
}

private static readonly FiniteSetLookup<Type, Type> FIBER_STATE_TYPES_MAP_CACHE = new FiniteSetLookup<Type, Type>( tfiber =>
private static readonly FiniteSetLookup<Type, (Type tp, Type ts)> FIBER_STATE_TYPES_MAP_CACHE = new FiniteSetLookup<Type, (Type, Type)>( tfiber =>
{
Type tancestor = tfiber;
while(tancestor != null && tancestor != typeof(object))
{
if (tancestor.GetGenericTypeDefinition() == typeof(Fiber<,>))
{
return tancestor.GetGenericArguments()[1].IsOfType<FiberState>("TState : FiberState");
var gargs = tancestor.GetGenericArguments();
var tp = gargs[0].IsOfType<FiberParameters>("TParams : FiberParameters");
var ts = gargs[1].IsOfType<FiberState>("TState : FiberState");
return (tp, ts);
}
tancestor = tancestor.BaseType;
}
Expand All @@ -514,7 +517,7 @@ private void reportUnknownImage(Guid guid)
Fiber fiber = null;
try
{
var tState = FIBER_STATE_TYPES_MAP_CACHE[tFiber].NonNull("TState != null");
var (tParemeters, tState) = FIBER_STATE_TYPES_MAP_CACHE[tFiber];
fiber = (Fiber)Serialization.SerializationUtils.MakeNewObjectInstance(tFiber);
//obtain state and parameters materialize(TParams, tState);
fiber.__processor__ctor(m_Runtime, null /*memory.Parameters*/, null/*memory.State*/);
Expand Down

0 comments on commit 0374685

Please sign in to comment.