Skip to content

Commit 0e0b0fb

Browse files
committed
Rename IJobs to ICommandSchedule
1 parent 76c9e94 commit 0e0b0fb

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace InEngine.Core
44
{
5-
public interface IJobs : IPluginType
5+
public interface ICommandSchedule : IPluginType
66
{
77
void Schedule(ISchedule schedule);
88
}

src/InEngine.Core/Queuing/Enqueue.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ public static IQueueLifeCycleActions Command(AbstractCommand command)
1818
return new QueueLifeCycleActions(command);
1919
}
2020

21-
public static IQueueLifeCycleActions Command(IList<AbstractCommand> commands)
21+
public static IQueueLifeCycleActions Command<T>(T command) where T : AbstractCommand
22+
{
23+
return new QueueLifeCycleActions(command);
24+
}
25+
26+
public static IQueueLifeCycleActions Commands(IList<AbstractCommand> commands)
2227
{
2328
return new QueueLifeCycleActions(new Chain() { Commands = commands });
2429
}

src/InEngine.Core/Queuing/Jobs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace InEngine.Core.Queuing
77
{
8-
public class Jobs : IJobs
8+
public class CommandSchedule : ICommandSchedule
99
{
1010
public void Schedule(ISchedule schedule)
1111
{
@@ -20,7 +20,7 @@ void ScheduleQueueConsumerJobs(ISchedule schedule, int consumers, bool useSecond
2020
throw new ArgumentOutOfRangeException(nameof(consumers), consumers, "The number of queue consumers must be 0 or greater.");
2121

2222
foreach (var index in Enumerable.Range(0, consumers).ToList())
23-
schedule.Job(new Consume()
23+
schedule.Command(new Consume()
2424
{
2525
ScheduleId = $"{(useSecondaryQueue ? "secondary" : "primary")}:{index.ToString()}",
2626
UseSecondaryQueue = useSecondaryQueue
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq.Expressions;
4+
using Quartz;
45

56
namespace InEngine.Core.Scheduling
67
{
78
public interface ISchedule
89
{
9-
Occurence Job(AbstractCommand command);
10-
Occurence Job(Expression<Action> expressionAction);
11-
Occurence Job(IList<AbstractCommand> commands);
10+
Occurence Command(AbstractCommand command);
11+
Occurence Command(Expression<Action> expressionAction);
12+
Occurence Command(IList<AbstractCommand> commands);
1213
}
1314
}

src/InEngine.Core/Scheduling/Schedule.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class Schedule : ISchedule
1616
public static IScheduler Scheduler { get { return lazyScheduler.Value; } }
1717
public IDictionary<string, JobGroup> JobGroups { get; set; } = new Dictionary<string, JobGroup>();
1818

19-
public Occurence Job(AbstractCommand command)
19+
public Occurence Command(AbstractCommand command)
2020
{
2121
var jobDetail = MakeJobBuilder(command).Build();
2222

@@ -35,14 +35,14 @@ public Occurence Job(AbstractCommand command)
3535
};
3636
}
3737

38-
public Occurence Job(Expression<Action> expressionAction)
38+
public Occurence Command(Expression<Action> expressionAction)
3939
{
40-
return Job(new Lambda() { ExpressionNode = expressionAction.ToExpressionNode() });
40+
return Command(new Lambda() { ExpressionNode = expressionAction.ToExpressionNode() });
4141
}
4242

43-
public Occurence Job(IList<AbstractCommand> commands)
43+
public Occurence Command(IList<AbstractCommand> commands)
4444
{
45-
return Job(new Chain() { Commands = commands });
45+
return Command(new Chain() { Commands = commands });
4646
}
4747

4848
public JobRegistration RegisterJob(AbstractCommand command, IJobDetail jobDetail, ITrigger trigger)
@@ -60,8 +60,8 @@ public JobRegistration RegisterJob(AbstractCommand command, IJobDetail jobDetail
6060

6161
public void Initialize()
6262
{
63-
Plugin.Load<IJobs>().ForEach(x => {
64-
x.Make<IJobs>().ForEach(y => y.Schedule(this));
63+
Plugin.Load<ICommandSchedule>().ForEach(x => {
64+
x.Make<ICommandSchedule>().ForEach(y => y.Schedule(this));
6565
});
6666

6767
JobGroups.AsEnumerable().ToList().ForEach(x => {

0 commit comments

Comments
 (0)