Table of Contents

Class TransactionsDecorator

Namespace
Foundation.Data.Doublets.Cli
Assembly
Foundation.Data.Doublets.Cli.dll

Decorator that records every Create/Update/Delete as a reversible Transition in a sidecar doublets log store. Supports explicit transactions, sync/async commits, three log retention policies, and crash recovery. Optional — no behavioural change if not opted in (R8).

public sealed class TransactionsDecorator : LinksDecoratorBase<uint>, ITransactionsLinks, INamedTypesLinks<uint>, ILinks<uint>, ILinks<uint, LinksConstants<uint>>, INamedTypes<uint>, IDisposable
Inheritance
LinksOperatorBase<uint>
LinksDecoratorBase<uint>
TransactionsDecorator
Implements
ILinks<uint>
ILinks<uint, LinksConstants<uint>>
Inherited Members
LinksDecoratorBase<uint>.Facade
LinksDecoratorBase<uint>.Constants
LinksOperatorBase<uint>.Links
Extension Methods

Constructors

public TransactionsDecorator(INamedTypesLinks<uint> inner, INamedTypesLinks<uint> logStore, LogRetentionPolicy? retentionPolicy = null, CommitMode commitMode = CommitMode.Sync, bool trace = false)

Parameters

inner INamedTypesLinks<uint>
logStore INamedTypesLinks<uint>
retentionPolicy LogRetentionPolicy
commitMode CommitMode
trace bool

Properties

AppliedSequence

public long AppliedSequence { get; }

Property Value

long

CommitMode

public CommitMode CommitMode { get; set; }

Property Value

CommitMode

LastLoggedSequence

public long LastLoggedSequence { get; }

Property Value

long

Log

public IReadOnlyList<Transition> Log { get; }

Property Value

IReadOnlyList<Transition>

RetentionPolicy

public LogRetentionPolicy RetentionPolicy { get; set; }

Property Value

LogRetentionPolicy

Methods

ApplyTransition(Transition)

Apply a single transition's side-effect against the data store without writing a new log entry. Intended for use by higher-level decorators (e.g. version control) that need to drive replay/rewind without producing additional transitions.

public void ApplyTransition(Transition transition)

Parameters

transition Transition

BeginTransaction()

public ITransaction BeginTransaction()

Returns

ITransaction

BeginTransactionAsync(CancellationToken)

public Task<ITransaction> BeginTransactionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<ITransaction>

Create(IList<uint>?, WriteHandler<uint>?)

Creates the restriction.

public override uint Create(IList<uint>? substitution, WriteHandler<uint>? handler)

Parameters

substitution IList<uint>
handler WriteHandler<uint>

Returns

uint

The link

Delete(IList<uint>?, WriteHandler<uint>?)

Deletes the restriction.

public override uint Delete(IList<uint>? restriction, WriteHandler<uint>? handler)

Parameters

restriction IList<uint>

The restriction.

handler WriteHandler<uint>

Returns

uint

Dispose()

Stops the background worker. The wrapped data store and log store are not disposed here; callers are expected to own those.

public void Dispose()

GetByName(string)

public uint GetByName(string name)

Parameters

name string

Returns

uint

GetName(uint)

public string? GetName(uint link)

Parameters

link uint

Returns

string

MakeTransitionsDatabaseFilename(string)

Conventional sidecar filename for the transitions log.

public static string MakeTransitionsDatabaseFilename(string databaseFilename)

Parameters

databaseFilename string

Returns

string

Recover()

public void Recover()

RemoveName(uint)

public void RemoveName(uint link)

Parameters

link uint

RevertTransition(Transition)

Revert a single transition's side-effect against the data store without writing a new log entry. Intended for use by higher-level decorators (e.g. version control) that need to drive replay/rewind without producing additional transitions.

public void RevertTransition(Transition transition)

Parameters

transition Transition

SetName(uint, string)

public uint SetName(uint link, string name)

Parameters

link uint
name string

Returns

uint

Shutdown()

Stops the background worker. Kept as a named method for backwards compatibility; Dispose() delegates to it.

public void Shutdown()

Update(IList<uint>?, IList<uint>?, WriteHandler<uint>?)

Updates the restriction.

public override uint Update(IList<uint>? restriction, IList<uint>? substitution, WriteHandler<uint>? handler)

Parameters

restriction IList<uint>

The restriction.

substitution IList<uint>

The substitution.

handler WriteHandler<uint>

Returns

uint

The link