Class UndoableLinksDecorator<TLinkAddress>
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
A store that keeps every write in a LinksUndoLog<TLinkAddress> while Recording, so a request that fails can be undone whole (issue #149). The links server puts it under every session.
public class UndoableLinksDecorator<TLinkAddress> : LinksDecoratorBase<TLinkAddress>, INamedTypesLinks<TLinkAddress>, ILinks<TLinkAddress>, ILinks<TLinkAddress, LinksConstants<TLinkAddress>>, INamedTypes<TLinkAddress> where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>
Type Parameters
TLinkAddress
- Inheritance
-
LinksOperatorBase<TLinkAddress>LinksDecoratorBase<TLinkAddress>UndoableLinksDecorator<TLinkAddress>
- Implements
-
INamedTypesLinks<TLinkAddress>ILinks<TLinkAddress>ILinks<TLinkAddress, LinksConstants<TLinkAddress>>INamedTypes<TLinkAddress>
- Inherited Members
-
LinksDecoratorBase<TLinkAddress>._constantsLinksDecoratorBase<TLinkAddress>._facadeLinksDecoratorBase<TLinkAddress>.FacadeLinksDecoratorBase<TLinkAddress>.ConstantsLinksOperatorBase<TLinkAddress>._linksLinksOperatorBase<TLinkAddress>.Links
- Extension Methods
Constructors
UndoableLinksDecorator(INamedTypesLinks<TLinkAddress>)
public UndoableLinksDecorator(INamedTypesLinks<TLinkAddress> links)
Parameters
linksINamedTypesLinks<TLinkAddress>
Properties
Log
The writes kept since Begin().
public LinksUndoLog<TLinkAddress> Log { get; }
Property Value
- LinksUndoLog<TLinkAddress>
QueryLimits
Optional admission limits for the ordinary query processor.
public QueryLimits? QueryLimits { get; }
Property Value
Recording
Whether writes are kept.
public bool Recording { get; }
Property Value
Methods
Begin()
Starts keeping writes, forgetting the ones kept before.
public void Begin()
Commit()
Stops keeping writes; they stay.
public void Commit()
Create(IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)
Creates the restriction.
public override TLinkAddress Create(IList<TLinkAddress>? substitution, WriteHandler<TLinkAddress>? handler)
Parameters
substitutionIList<TLinkAddress>The restriction.
handlerWriteHandler<TLinkAddress>Optional callback; null continues without invoking a callback.
Returns
- TLinkAddress
The link
Delete(IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)
Deletes the restriction.
public override TLinkAddress Delete(IList<TLinkAddress>? restriction, WriteHandler<TLinkAddress>? handler)
Parameters
restrictionIList<TLinkAddress>The restriction.
handlerWriteHandler<TLinkAddress>Optional callback; null continues without invoking a callback.
Returns
- TLinkAddress
GetByName(string)
public TLinkAddress GetByName(string name)
Parameters
namestring
Returns
- TLinkAddress
GetName(TLinkAddress)
public string? GetName(TLinkAddress link)
Parameters
linkTLinkAddress
Returns
RemoveName(TLinkAddress)
public void RemoveName(TLinkAddress link)
Parameters
linkTLinkAddress
ReserveQueryAllocations(Action<INamedTypesLinks<TLinkAddress>>)
Preview a query over owned rows and reserve its allocation order. Returns final identities, or null when the store uses legacy prediction.
public IReadOnlySet<TLinkAddress>? ReserveQueryAllocations(Action<INamedTypesLinks<TLinkAddress>> preview)
Parameters
previewAction<INamedTypesLinks<TLinkAddress>>
Returns
- IReadOnlySet<TLinkAddress>
Rollback()
Undoes every write kept since Begin().
public IReadOnlyList<TLinkAddress> Rollback()
Returns
- IReadOnlyList<TLinkAddress>
The addresses of the links the writes created, now deleted again.
SetName(TLinkAddress, string)
public TLinkAddress SetName(TLinkAddress link, string name)
Parameters
linkTLinkAddressnamestring
Returns
- TLinkAddress
Update(IList<TLinkAddress>?, IList<TLinkAddress>?, WriteHandler<TLinkAddress>?)
Updates the restriction.
public override TLinkAddress Update(IList<TLinkAddress>? restriction, IList<TLinkAddress>? substitution, WriteHandler<TLinkAddress>? handler)
Parameters
restrictionIList<TLinkAddress>The restriction.
substitutionIList<TLinkAddress>The substitution.
handlerWriteHandler<TLinkAddress>Optional callback; null continues without invoking a callback.
Returns
- TLinkAddress
The link