Class LinksUniquenessAndUsagesRepointingResolver<TLinkAddress>
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
Keeps every doublet unique: an update that would duplicate an existing link merges into it instead, re-pointing every link that used the merged-away address at the surviving one.
public class LinksUniquenessAndUsagesRepointingResolver<TLinkAddress> : LinksUniquenessResolver<TLinkAddress>, ILinks<TLinkAddress>, ILinks<TLinkAddress, LinksConstants<TLinkAddress>> where TLinkAddress : IUnsignedNumber<TLinkAddress>
Type Parameters
TLinkAddress
- Inheritance
-
LinksOperatorBase<TLinkAddress>LinksDecoratorBase<TLinkAddress>LinksUniquenessResolver<TLinkAddress>LinksUniquenessAndUsagesRepointingResolver<TLinkAddress>
- Implements
-
ILinks<TLinkAddress>ILinks<TLinkAddress, LinksConstants<TLinkAddress>>
- Inherited Members
-
LinksDecoratorBase<TLinkAddress>._constantsLinksDecoratorBase<TLinkAddress>._facadeLinksDecoratorBase<TLinkAddress>.FacadeLinksDecoratorBase<TLinkAddress>.ConstantsLinksOperatorBase<TLinkAddress>._linksLinksOperatorBase<TLinkAddress>.Links
- Extension Methods
Remarks
Replaces Platform.Data.Doublets.Decorators.LinksCascadeUniquenessAndUsagesResolver<TLinkAddress>, whose
MergeUsages in Platform.Data.Doublets 0.18.1 writes (index: a, source: b, target: 0)
where it means (source: a, target: b), so a usage loses its target instead of being re-pointed
(https://github.com/linksplatform/Data.Doublets/issues/515).
A merge reports the re-pointed usages and the deletion of the merged-away link, nothing else. Since
Platform.Data.Doublets 0.18.6 the base resolver also ends a merge by reporting the surviving link unchanged;
that notice is not passed on, so a merge reports the same changes as in the Rust port, where
clink --changes and the protocol server do not list a link the write did not touch.
Constructors
LinksUniquenessAndUsagesRepointingResolver(ILinks<TLinkAddress>)
public LinksUniquenessAndUsagesRepointingResolver(ILinks<TLinkAddress> links)
Parameters
linksILinks<TLinkAddress>
Methods
RepointUsages(TLinkAddress, TLinkAddress, WriteHandler<TLinkAddress>?)
Replaces oldLinkAddress with newLinkAddress in every link that uses it,
both halves of a link in one update.
public virtual TLinkAddress RepointUsages(TLinkAddress oldLinkAddress, TLinkAddress newLinkAddress, WriteHandler<TLinkAddress>? handler)
Parameters
oldLinkAddressTLinkAddressnewLinkAddressTLinkAddresshandlerWriteHandler<TLinkAddress>
Returns
- TLinkAddress
ResolveAddressChangeConflict(TLinkAddress, TLinkAddress, WriteHandler<TLinkAddress>?)
Resolves the address change conflict using the specified old link address.
protected override TLinkAddress ResolveAddressChangeConflict(TLinkAddress oldLinkAddress, TLinkAddress newLinkAddress, WriteHandler<TLinkAddress>? handler)
Parameters
oldLinkAddressTLinkAddressThe old link address.
newLinkAddressTLinkAddressThe new link address.
handlerWriteHandler<TLinkAddress>Optional callback; null continues without invoking a callback.
Returns
- TLinkAddress
Callback control (Continue or Break).
Remarks
Cleanup is followed by a survivor-to-survivor notification that identifies the resolved link, including unchanged pairs. Break suppresses later notifications while cleanup completes.