-
Notifications
You must be signed in to change notification settings - Fork 6
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 #1693 from Cratis/fix/job-request-deiscriminator
Fix/job request deiscriminator
- Loading branch information
Showing
66 changed files
with
715 additions
and
225 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
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,9 @@ | ||
// Copyright (c) Cratis. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Cratis.Chronicle.Concepts.Jobs; | ||
|
||
/// <summary> | ||
/// Defines a job request. | ||
/// </summary> | ||
public interface IJobRequest; |
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,58 @@ | ||
// Copyright (c) Cratis. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using OneOf.Types; | ||
namespace Cratis.Chronicle.Concepts.Jobs; | ||
|
||
/// <summary> | ||
/// Defines a system that knows about <see cref="JobType"/> job types and how to correlate it to CLR <see cref="Type"/>. | ||
/// </summary> | ||
public interface IJobTypes | ||
{ | ||
/// <summary> | ||
/// Error types for <see cref="IJobTypes.GetRequestClrTypeFor"/>. | ||
/// </summary> | ||
enum GetRequestClrTypeForError | ||
{ | ||
JobTypeIsNotSet = 0, | ||
CouldNotFindType = 1 | ||
} | ||
|
||
/// <summary> | ||
/// Error types for <see cref="IJobTypes.GetClrTypeFor"/>. | ||
/// </summary> | ||
enum GetClrTypeForError | ||
{ | ||
JobTypeIsNotSet = 0, | ||
CouldNotFindType = 1 | ||
} | ||
|
||
/// <summary> | ||
/// Error types for <see cref="IJobTypes.GetFor"/>. | ||
/// </summary> | ||
enum GetForError | ||
{ | ||
NoAssociatedJobType = 0 | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="JobType"/> associated with the CLR <see cref="Type"/> or <see cref="None"/>. | ||
/// </summary> | ||
/// <param name="type">The <see cref="Type"/>.</param> | ||
/// <returns><see cref="Result{T0, T1}"/> <see cref="JobType"/> or <see cref="None"/>.</returns> | ||
Result<JobType, GetForError> GetFor(Type type); | ||
|
||
/// <summary> | ||
/// Gets the job <see cref="Type"/> associated with the <see cref="JobType"/>. | ||
/// </summary> | ||
/// <param name="type">The <see cref="JobType"/>.</param> | ||
/// <returns><see cref="Result{T0, T1}"/> <see cref="Type"/> or <see cref="GetClrTypeForError"/>.</returns> | ||
Result<Type, GetClrTypeForError> GetClrTypeFor(JobType type); | ||
|
||
/// <summary> | ||
/// Gets the job request <see cref="Type"/> associated with the <see cref="JobType"/>. | ||
/// </summary> | ||
/// <param name="type">The <see cref="JobType"/>.</param> | ||
/// <returns><see cref="Result{T0, T1}"/> <see cref="Type"/> or <see cref="GetRequestClrTypeForError"/>.</returns> | ||
Result<Type, GetRequestClrTypeForError> GetRequestClrTypeFor(JobType type); | ||
} |
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,17 @@ | ||
// Copyright (c) Cratis. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Cratis.Chronicle.Concepts.Jobs; | ||
|
||
/// <summary> | ||
/// Represents the JobType attribute that can be placed on job type classes to specify the <see cref="JobType"/> name. | ||
/// </summary> | ||
/// <param name="jobType">The job type name to use.</param> | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public sealed class JobTypeAttribute(string jobType) : Attribute | ||
{ | ||
/// <summary> | ||
/// Gets the <see cref="JobType"/>. | ||
/// </summary> | ||
public JobType JobType { get; } = new(jobType); | ||
} |
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
3 changes: 2 additions & 1 deletion
3
Source/Kernel/Grains.Interfaces/Observation/Jobs/IObserverJobRequest.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
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
Oops, something went wrong.