Table of Contents

Class DirectoryScanOptions

Namespace
Quartz.Jobs
Assembly
Quartz.Jobs.dll

What DirectoryScanJob scans and when it considers a file settled.

public sealed record DirectoryScanOptions : IEquatable<DirectoryScanOptions>
Inheritance
DirectoryScanOptions
Implements
Inherited Members

Remarks

The job is configured through its JobDataMap, and those keys are the persisted contract — this type is the named way to write and read them. UsingDirectoryScanOptions<TConfigurator>(TConfigurator, DirectoryScanOptions) writes them, FromJobData(JobDataMap) reads them back, and job data written by hand or by an earlier version reads the same either way.

The directories to scan come either from Directories or from an IDirectoryProvider named by DirectoryProviderName. Naming neither leaves the job nothing to scan, which it reports when it first fires.

Properties

Directories

The directories to monitor; absolute paths are recommended. They are stored semicolon-separated under DirectoryNames, so a path may not itself contain a semicolon.

public IReadOnlyList<string> Directories { get; init; }

Property Value

IReadOnlyList<string>

DirectoryProviderName

The SchedulerContext key of an IDirectoryProvider that supplies the directories instead of Directories, or null to use the paths in Directories.

public string? DirectoryProviderName { get; init; }

Property Value

string

IncludeSubDirectories

Whether to descend into sub-directories. Defaults to false.

public bool IncludeSubDirectories { get; init; }

Property Value

bool

MinimumUpdateAge

How long a file must have been left alone to count as new or altered rather than as one another process is still writing. Defaults to five seconds.

public TimeSpan MinimumUpdateAge { get; init; }

Property Value

TimeSpan

Remarks

Persisted as a whole number of milliseconds under MinimumUpdateAge, which is what earlier versions wrote.

ScanListenerName

The name of the IDirectoryScanListener to notify: either a type registered in the container, or a SchedulerContext key an instance is stored under.

public required string ScanListenerName { get; init; }

Property Value

string

SearchPattern

The pattern file names must match, which may combine literal path characters with the and ? wildcards. Defaults to , every file.

public string SearchPattern { get; init; }

Property Value

string

Methods

Equals(DirectoryScanOptions?)

Two sets of options are equal when they say the same thing, which for Directories means the same paths in the same order.

public bool Equals(DirectoryScanOptions? other)

Parameters

other DirectoryScanOptions

Returns

bool

Remarks

Spelled out because the compiler's version would compare the list by reference, and two options records read out of the same job data would then differ.

FromJobData(JobDataMap)

Reads the options out of a job's data, taking the default for every key it does not carry.

public static DirectoryScanOptions FromJobData(JobDataMap data)

Parameters

data JobDataMap

The job data to read, normally MergedJobDataMap.

Returns

DirectoryScanOptions

Exceptions

JobExecutionException

DirectoryScanListenerName is absent; there is nothing to notify, so nothing the job can usefully do.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToJobData()

Writes the options as the job data keys DirectoryScanJob reads.

public JobDataMap ToJobData()

Returns

JobDataMap