Documentation
Table of Contents

Method ReplaceAsync

Namespace
IntentSharp.Mapping
Assembly
IntentSharp.dll

ReplaceAsync(CompiledMapping, MappingRetiredReason, CompiledMapping, CancellationToken)

In one transaction: retires retiring with reason only if that revision is still active, and then stores replacement as the next revision with the status Active. When another writer replaced retiring first, nothing is written and that writer's row is returned; when the key has no active revision at all, replacement is stored as the active one. Returns the active row.

public Task<CompiledMapping> ReplaceAsync(CompiledMapping retiring, MappingRetiredReason reason, CompiledMapping replacement, CancellationToken cancellationToken = default)

Parameters

retiring CompiledMapping

The active revision being replaced, by its namespace, key and revision.

reason MappingRetiredReason

Why it is retired: a category, step, op and path, never an input value.

replacement CompiledMapping

The row that replaces it.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<CompiledMapping>

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

The two rows name different namespaces or keys, or the replacement cannot be stored.