Experemental

pull/1/head
Ogoun 5 years ago
parent fe6eabb194
commit 3ca25d345b

@ -1,5 +1,4 @@
using System; using System;
using ZeroLevel.Services.Logging;
namespace ZeroLevel.Logging namespace ZeroLevel.Logging
{ {

@ -517,6 +517,7 @@ namespace ZeroLevel.Services.Serialization
wrapper.ReadId = wrapper.Invoker.ConfigureGeneric(typeof(MemoryStreamReader), elementType, readName).First(); wrapper.ReadId = wrapper.Invoker.ConfigureGeneric(typeof(MemoryStreamReader), elementType, readName).First();
wrapper.WriteId = wrapper.Invoker.ConfigureGeneric(typeof(MemoryStreamWriter), elementType, wrapper.WriteId = wrapper.Invoker.ConfigureGeneric(typeof(MemoryStreamWriter), elementType,
mi => mi.Name.Equals(writeName) && mi.IsGenericMethod).First(); mi => mi.Name.Equals(writeName) && mi.IsGenericMethod).First();
_concrete_type_cachee[type] = wrapper; _concrete_type_cachee[type] = wrapper;
} }
} }

@ -10,6 +10,9 @@ namespace ZeroLevel.Services.Shedulling
{ {
private static long _counter = 0; private static long _counter = 0;
internal static void ResetIndex(long index)
=> _counter = index;
public ExpiredObject() public ExpiredObject()
{ {
Key = Interlocked.Increment(ref _counter); Key = Interlocked.Increment(ref _counter);

@ -92,6 +92,8 @@ namespace ZeroLevel.Services.Shedulling
bool Remove(long key); bool Remove(long key);
void SetInitialIndex(long index);
#endregion Sheduller control #endregion Sheduller control
} }
} }

@ -288,6 +288,10 @@ namespace ZeroLevel.Services.Shedulling
return success; return success;
} }
public void SetInitialIndex(long index)
{
ExpiredObject.ResetIndex(index);
}
#endregion Sheduller control #endregion Sheduller control
#region IDisposable #region IDisposable
@ -305,7 +309,6 @@ namespace ZeroLevel.Services.Shedulling
_sheduller.Dispose(); _sheduller.Dispose();
} }
} }
#endregion IDisposable #endregion IDisposable
} }
} }

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using ZeroLevel.Services.Serialization;
namespace ZeroLevel.Services.Shedulling
{
public interface ITaskDb
{
long GetLastCounter();
void Store(TaskRecord task);
}
public class TaskRecord
{
public long Identity;
public string TypeName;
public string MethodName;
public IBinarySerializable Parameter;
public TaskGroup Parent;
}
public class TaskGroup
{
public long Identity;
public IEnumerable<TaskRecord> Tasks;
public TaskPipeline Parent;
}
public class TaskPipeline
{
public long Identity;
IEnumerable<TaskGroup> Pipeline;
public TaskQueue Parent;
}
public class TaskQueue
{
public long Identity;
}
public class TaskDispatcher
{
ISheduller sheduller;
public TaskDispatcher(ITaskDb db)
{
sheduller.SetInitialIndex(db.GetLastCounter());
}
private MethodInfo FindMethod(TaskRecord task)
{
var type = Type.GetType(task.TypeName);
var method = type.GetMethods().First(m => m.Name.Equals(task.MethodName, StringComparison.Ordinal));
return method;
}
public static void Add<T>(Expression<Action<T>> methodCall)
{
}
}
}
Loading…
Cancel
Save

Powered by TurnKey Linux.