Skip to content

Commit ef86179

Browse files
Preliminary API definition
1 parent c82b6c3 commit ef86179

File tree

17 files changed

+155
-8
lines changed

17 files changed

+155
-8
lines changed

.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ dotnet_analyzer_diagnostic.category-Style.severity = warning
288288

289289
# XML Documentation
290290
dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
291-
dotnet_diagnostic.CS1573.severity = none # CS1573: Missing XML comment for parameter
292-
dotnet_diagnostic.CS1591.severity = none # CS1591: Missing XML comment for publicly visible type or member
293-
dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
291+
dotnet_diagnostic.CS1573.severity = error # CS1573: Missing XML comment for parameter
292+
dotnet_diagnostic.CS1591.severity = error # CS1591: Missing XML comment for publicly visible type or member
293+
dotnet_diagnostic.CS1712.severity = error # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
294294

295295
# Async
296296
dotnet_diagnostic.CS1998.severity = error # CS1998: Async method lacks 'await' operators and will run synchronously

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
1919
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
2020
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" />
21+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.6" />
2122
<PackageVersion Include="MinVer" Version="6.0.0" />
2223
<PackageVersion Include="Scriban" Version="6.2.1" />
2324
<PackageVersion Include="TUnit.Engine" Version="0.21.13" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*.cs]
2+
3+
# XML Documentation
4+
dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
5+
dotnet_diagnostic.CS1573.severity = none # CS1573: Missing XML comment for parameter
6+
dotnet_diagnostic.CS1591.severity = none # CS1591: Missing XML comment for publicly visible type or member
7+
dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*.cs]
2+
3+
# XML Documentation
4+
dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
5+
dotnet_diagnostic.CS1573.severity = none # CS1573: Missing XML comment for parameter
6+
dotnet_diagnostic.CS1591.severity = none # CS1591: Missing XML comment for publicly visible type or member
7+
dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*.cs]
2+
3+
# XML Documentation
4+
dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
5+
dotnet_diagnostic.CS1573.severity = none # CS1573: Missing XML comment for parameter
6+
dotnet_diagnostic.CS1591.severity = none # CS1591: Missing XML comment for publicly visible type or member
7+
dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter has no matching typeparam tag in the XML comment (but other type parameters do)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Immediate.Jobs.Attributes;
2+
3+
[AttributeUsage(AttributeTargets.Class)]
4+
public sealed class JobAttribute : Attribute
5+
{
6+
public JobAttribute(string keyId)
7+
{
8+
KeyId = keyId;
9+
}
10+
11+
public string KeyId { get; }
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Immediate.Jobs.Attributes;
2+
3+
[AttributeUsage(AttributeTargets.Class)]
4+
public sealed class RecurringJobAttribute : Attribute
5+
{
6+
public RecurringJobAttribute(
7+
string cronExpression,
8+
string timeZone
9+
)
10+
{
11+
CronExpression = cronExpression;
12+
TimeZone = timeZone;
13+
}
14+
15+
public string CronExpression { get; }
16+
public string TimeZone { get; }
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Immediate.Jobs.Models;
2+
3+
namespace Immediate.Jobs.Contracts;
4+
5+
public interface IStorageProvider
6+
{
7+
Task<IReadOnlyList<Job>> GetJobs(JobSearchParameters searchParameters);
8+
Task<string> EnqueueJob(Job job, JobServer? jobServer);
9+
Task<bool> ClaimJob(Job job, JobServer jobServer);
10+
Task CompleteJob(Job job);
11+
Task FailJob(Job job, Exception exception);
12+
Task CancelJob(Job job);
13+
14+
Task<IReadOnlyList<JobServer>> GetServers();
15+
Task EnlistServer(JobServer server);
16+
Task DelistServer(JobServer server);
17+
}

src/Immediate.Jobs/Immediate.Jobs.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929
<None Include="../Immediate.Jobs.CodeFixes/bin/$(Configuration)/netstandard2.0/Immediate.Jobs.CodeFixes.dll" Pack="true" PackagePath="analyzers/roslyn4.8/dotnet/cs" Visible="false" />
3030
<None Include="../Immediate.Jobs.Generators/bin/$(Configuration)/netstandard2.0/Immediate.Jobs.Generators.dll" Pack="true" PackagePath="analyzers/roslyn4.8/dotnet/cs" Visible="false" />
3131

32-
<TfmSpecificPackageFile
33-
Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll"
34-
Pack="true"
35-
PackagePath="analyzers/roslyn4.8/dotnet/cs"
36-
Condition=" '$(TargetFramework)' == 'net8.0' " />
32+
<TfmSpecificPackageFile Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll" Pack="true" PackagePath="analyzers/roslyn4.8/dotnet/cs" Condition=" '$(TargetFramework)' == 'net8.0' " />
3733
</ItemGroup>
3834

3935
<ItemGroup>
@@ -46,6 +42,7 @@
4642

4743
<ItemGroup>
4844
<PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All" />
45+
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
4946
<PackageReference Include="MinVer" PrivateAssets="all" />
5047
</ItemGroup>
5148

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Immediate.Jobs.Contracts;
2+
using Microsoft.Extensions.DependencyInjection;
3+
4+
namespace Immediate.Jobs;
5+
6+
public static class ImmediateJobsServiceCollectionExtensions
7+
{
8+
public static IServiceCollection AddImmediateJobsManager(this IServiceCollection services)
9+
{
10+
return services
11+
.AddHostedService<JobManager>()
12+
.AddSingleton<JobManager>()
13+
.AddSingleton<IStorageProvider>(_ => new InMemoryStorageProvider());
14+
}
15+
}

0 commit comments

Comments
 (0)