Class ConcurrencyOptions
- Assembly
- Cratis.Chronicle.dll
Represents options for configuring concurrency strategies.
public class ConcurrencyOptions
- Inheritance
-
ConcurrencyOptions
- Inherited Members
- Extension Methods
Constructors
ConcurrencyOptions()
public ConcurrencyOptions()
Fields
CheckFirstAppendIntoAScopeByDefault
The value CheckFirstAppendIntoAScope takes when nothing configures it.
public const bool CheckFirstAppendIntoAScopeByDefault = false
Field Value
Remarks
False keeps the behavior every released version has had: the first append into a narrowed scope is not checked. It is scheduled to become true in the next major version, and flipping this one value is the whole change - OptimisticConcurrencyStrategy and the options property both read it, so nothing else has to move.
Properties
AllowRouteScopeStreamMismatch
Gets or sets a value indicating whether a definition-linked explicit scope may guard a different stream than a single-route append.
public bool AllowRouteScopeStreamMismatch { get; set; }
Property Value
Remarks
False by default. Labelled independent conditions are not subject to this check.
CheckFirstAppendIntoAScope
Gets or sets a value indicating whether the first append into a concurrency scope is checked.
public bool CheckFirstAppendIntoAScope { get; set; }
Property Value
Remarks
A concurrency check needs something to compare against, and OptimisticConcurrencyStrategy gets it by reading the tail through the scope's own narrowing. When nothing matches that narrowing yet there is no tail to read. With this false - the default, and what every released version does - the scope carries no expectation and the kernel skips the check, so the first append into each scope goes through unchecked. That is the append most exposed to a race, because it opens a new narrowed partition on a stream other writers are already using.
With this true the strategy says what a first append actually expects - that no event matching the narrowing exists - and the kernel checks it, rejecting the append with a concurrency violation if one appeared in the meantime. Turning it on will reject appends that succeed with it off, which is why it is opt-in rather than the default. It is scheduled to become the default in the next major version.
This governs the strategy. A single append can ask for the same check without turning this on, by building a scope with ExpectingNoMatchingEvent().
DefaultStrategy
Gets or sets the default concurrency strategy to use when no specific strategy is provided.
public Type DefaultStrategy { get; set; }
Property Value
SkipIncompleteExplicitScopes
Gets or sets a value indicating whether incomplete caller-supplied scopes retain the legacy unchecked behavior.
public bool SkipIncompleteExplicitScopes { get; set; }
Property Value
Remarks
False by default. Incomplete narrowed explicit scopes otherwise expect no matching event.