Skip to content

Options

Meyn edited this page Dec 15, 2025 · 4 revisions

Summary

$\text{\color{orange}I\color{none}RequestOptions<\color{green}TCompleated\color{none},\color{red}TFailed\color{none}>}$

The IRequestOptions<> interface serves as a blueprint for defining properties and methods necessary for a Request<>. It is a generic interface, allowing for two type parameters:

Generic Parameters:

  • $\text{\color{green}TCompleated}$: Type: None
    • Represents the return type when the Request<> completes successfully.
  • $\text{\color{red}TFailed}$: Type: None
    • Represents the return type when the Request<> fails to run successfully after all retries.

Properties:

  • AutoStart: Type: bool
    • Set if the Request<> should start on initialization.
  • Priority: Type: RequestPriority
    • Sets the priority of the Request<>.
  • DeployDelay: Type: Nullable<TimeSpan>
    • Sets the time a Request<> should wait after Start to be deployed.
  • Handler: Type: RequestHandler
    • Sets the RequestHandler instance for the Request<>.
  • NumberOfAttempts: Type: byte
    • Sets the number of times an instance of Request<> should retry on failure.
  • DelayBetweenAttempts: Type: Nullable<TimeSpan>
    • Sets the delay between retries of a Request<>.
  • CancellationToken: Type: Nullable<CancellationToken>
    • Sets a CancellationToken instance that will be linked with the Request<>. If canceled, the request will also be canceled.
  • RequestCancelled: Type: Nullable<Notify<IRequest>>
    • Event that is going to be invoked when the Request<> is canceled.
  • RequestStarted: Type: Nullable<Notify<IRequest>>
    • Event that is going to be invoked when the Request<> starts.
  • RequestCompleted: Type: Nullable<Notify<IRequest, TCompleted>>
    • Event that is going to be invoked when the Request<> is completed successfully.
  • RequestFailed: Type: Nullable<Notify<IRequest, TFailed>>
    • Event that is going to be invoked when the Request<> fails.

$\text{RequestOptions&lt;\color{green}TCompleated\color{none},\color{red}TFailed\color{none}&gt;}$ Record

The RequestOptions<> record provides the functionalities of IRequestOptions<>. It inherits from IRequestOptions<> and includes its generic parameters.

Generic Parameters:

  • $\text{\color{green}TCompleated}$: Type: None
    • Represents the return type when the Request<> completes successfully.
  • $\text{\color{red}TFailed}$: Type: None
    • Represents the return type when the Request<> fails to run successfully after all retries.

Properties:

  • AutoStart: Type: bool
    • Set if the Request<> should start on initialization.
  • Priority: Type: RequestPriority
    • Sets the priority of the Request<>.
  • DeployDelay: Type: Nullable<TimeSpan>
    • Sets the time a Request<> should wait after Start to be deployed.
  • Handler: Type: RequestHandler
    • Sets the RequestHandler instance for the Request<>.
  • NumberOfAttempts: Type: byte
    • Sets the number of times an instance of Request<> should retry on failure.
  • DelayBetweenAttempts: Type: Nullable<TimeSpan>
    • Sets the delay between retries of a Request<>.
  • CancellationToken: Type: Nullable<CancellationToken>
    • Sets a CancellationToken instance that will be linked with the Request<>. If canceled, the request will also be canceled.
  • RequestCancelled: Type: Nullable<Notify<IRequest>>
    • Event that is going to be invoked when the Request<> is canceled.
  • RequestStarted: Type: Nullable<Notify<IRequest>>
    • Event that is going to be invoked when the Request<> starts.
  • RequestCompleted: Type: Nullable<Notify<IRequest, TCompleated>>
    • Event that is going to be invoked when the Request<> is completed successfully.
  • RequestFailed: Type: Nullable<Notify<IRequest, TFailed>>
    • Event that is going to be invoked when the Request<> fails.

Methods:

  • Constructor:
    • Creates a RequestOptions<> object.
  • protected Constructor:
    • Copy constructor for the RequestOptions<> record.

$\text{RequestState}$ Enum

The RequestState enum defines the various states for an IRequest.

Values:

  • Idle:
    • The IRequest has been started but has not yet been processed by the RequestHandler.
  • Running:
    • The IRequest is currently running.
  • Completed:
    • The IRequest has successfully completed.
  • Paused:
    • The IRequest is in a paused state.
  • Waiting:
    • The IRequest is waiting to be deployed after being started.
  • Cancelled:
    • The IRequest was canceled.
  • Failed:
    • The IRequest failed all retry attempts.

$\text{RequestPriority}$ Enum

The RequestPriority enum outlines the priority states for an IRequest.

Values:

  • High:
    • The IRequest will be processed first.
  • Normal:
    • The IRequest will be processed after high but before low.
  • Low:
    • The IRequest will be processed last.

$\text{NotifyDelegates}$ Collection

The NotifyDelegates collection includes various delegate types for notifying listeners. These delegates serve different purposes, such as event handling and passing data. They enhance code modularity and communication for IRequest.

Classes:

  • VoidStruct:

    • A simple struct with no fields or methods.
  • NotifyVoid:

    • A delegate that has no return type or parameters.
  • Notify<T>:

    • A generic delegate with no return type but a generic parameter.
    • Type parameter: T (can be any type).
    • Method signature: void Notify<T>(T? element).
  • Notify<T0, T1>:

    • A generic delegate with no return type but two generic parameters.
    • Type parameters: T0 and T1 (can be any types).
    • Method signature: void Notify<T0, T1>(T0? element0, T1? element1).

Clone this wiki locally