-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from TeamStepping/rename-to-atomic-job
Rename `DistributedJob` to `AtomicJob`
- Loading branch information
Showing
30 changed files
with
162 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Stepping.Core.Databases; | ||
|
||
namespace Stepping.Core.Jobs; | ||
|
||
public class AtomicJobFactory : IAtomicJobFactory | ||
{ | ||
protected IServiceProvider ServiceProvider { get; } | ||
|
||
public AtomicJobFactory(IServiceProvider serviceProvider) | ||
{ | ||
ServiceProvider = serviceProvider; | ||
} | ||
|
||
public virtual async Task<IAtomicJob> CreateJobAsync(string? gid, ISteppingDbContext? dbContext) | ||
{ | ||
return new AtomicJob(gid ?? await GenerateGidAsync(), dbContext, ServiceProvider); | ||
} | ||
|
||
public virtual async Task<IAdvancedAtomicJob> CreateAdvancedJobAsync(string? gid, | ||
ISteppingDbContext? dbContext) | ||
{ | ||
return new AtomicJob(gid ?? await GenerateGidAsync(), dbContext, ServiceProvider); | ||
} | ||
|
||
protected virtual async Task<string> GenerateGidAsync() | ||
{ | ||
var generator = ServiceProvider.GetRequiredService<IAtomicJobGidGenerator>(); | ||
|
||
return await generator.CreateAsync(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Stepping.Core/Stepping/Core/Jobs/AtomicJobFactoryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Stepping.Core.Databases; | ||
|
||
namespace Stepping.Core.Jobs; | ||
|
||
public static class AtomicJobFactoryExtensions | ||
{ | ||
public static Task<IAtomicJob> CreateJobAsync(this IAtomicJobFactory factory, | ||
ISteppingDbContext dbContext) => factory.CreateJobAsync(null, dbContext); | ||
|
||
public static Task<IAdvancedAtomicJob> CreateAdvancedJobAsync(this IAtomicJobFactory factory, | ||
ISteppingDbContext dbContext) => factory.CreateAdvancedJobAsync(null, dbContext); | ||
} |
2 changes: 1 addition & 1 deletion
2
...g/Core/Jobs/DistributedJobGidGenerator.cs → ...epping/Core/Jobs/AtomicJobGidGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace Stepping.Core.Jobs; | ||
|
||
public class DistributedJobGidGenerator : IDistributedJobGidGenerator | ||
public class AtomicJobGidGenerator : IAtomicJobGidGenerator | ||
{ | ||
public Task<string> CreateAsync() => Task.FromResult(Guid.NewGuid().ToString()); | ||
} |
32 changes: 0 additions & 32 deletions
32
src/Stepping.Core/Stepping/Core/Jobs/DistributedJobFactory.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/Stepping.Core/Stepping/Core/Jobs/DistributedJobFactoryExtensions.cs
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ping/Core/Jobs/IAdvancedDistributedJob.cs → .../Stepping/Core/Jobs/IAdvancedAtomicJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Stepping.Core.Databases; | ||
|
||
namespace Stepping.Core.Jobs; | ||
|
||
public interface IAtomicJobFactory | ||
{ | ||
Task<IAtomicJob> CreateJobAsync(string? gid = null, ISteppingDbContext? dbContext = null); | ||
|
||
Task<IAdvancedAtomicJob> CreateAdvancedJobAsync(string? gid = null, ISteppingDbContext? dbContext = null); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../Core/Jobs/IDistributedJobGidGenerator.cs → ...pping/Core/Jobs/IAtomicJobGidGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace Stepping.Core.Jobs; | ||
|
||
public interface IDistributedJobGidGenerator | ||
public interface IAtomicJobGidGenerator | ||
{ | ||
Task<string> CreateAsync(); | ||
} |
10 changes: 0 additions & 10 deletions
10
src/Stepping.Core/Stepping/Core/Jobs/IDistributedJobFactory.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.