Table of Contents

Struct JobType

Namespace
MailFathom.Application.Jobs
Assembly
MailFathom.Application.dll

Names one kind of durable background work, and with it the one payload contract that work is described by.

[JsonConverter(typeof(JobTypeJsonConverter))]
public readonly record struct JobType : IEquatable<JobType>
Implements
Inherited Members

Remarks

The type is a closed enumeration of values rather than a C# enum, because the name is the identity: it is the word in a log line, the name of a span, the dimension a counter is broken down by, and the text stored in the job row. An enum member's ordinal would carry no meaning outside this assembly, and a name derived from the member would change with every rename of the work it belongs to.

The set is closed because nothing outside this repository enqueues. Every enqueuer is in-tree, so an open string would model a plugin surface that does not exist, would make the type an unbounded metric dimension, and would leave a name read back from the database with no defined meaning. A closed set parses an unknown name as unknown and leaves the row where it is, which is what makes a rolling deployment safe: a job whose type a running version does not know is a fact about the deployment rather than about the work.

A type names exactly one payload contract, which is what lets a stored document be read back as the shape it was written as without a discriminator invented for the purpose. Being a struct, default is reachable and names no type; IsSpecified reports that, and the enqueue and claim contracts refuse it.

Properties

All

Gets every declared job type.

ClassifyEmailSpam

Gets the type whose work is deciding whether one stored message occurrence is junk.

IsSpecified

Gets whether this value names a declared job type rather than the unusable struct default.

Name

Gets the name a log line, a span, a counter dimension, and the stored row all use for the type.

RunScheduledMailRules

Gets the type whose work is asking for one account's scheduled rules to be run over its whole mailbox.

Methods

ToString()

Returns the fully qualified type name of this instance.

TryParseName(string?, out JobType)

Parses a recorded name back into the job type it names.