Class RemapLinksDecorator<TLinkAddress>
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
A links network under other addresses (issue #149): every address that
goes down is mapped to the network's own, and every address that comes up
is mapped back, so the code above never thinks about remapping. The
JavaScript counterpart is RemapLinks of
@link-foundation/link-cli-client, whose addresses above may be
strings such as UUIDs; the Rust one is link_cli::RemapLinks.
public class RemapLinksDecorator<TLinkAddress> : LinksDecoratorBase<TLinkAddress>, INamedTypesLinks<TLinkAddress>, ILinks<TLinkAddress>, ILinks<TLinkAddress, LinksConstants<TLinkAddress>>, INamedTypes<TLinkAddress>, IComposedLinks<TLinkAddress> where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>
Type Parameters
TLinkAddress
- Inheritance
-
LinksOperatorBase<TLinkAddress>LinksDecoratorBase<TLinkAddress>RemapLinksDecorator<TLinkAddress>
- Implements
-
INamedTypesLinks<TLinkAddress>ILinks<TLinkAddress>ILinks<TLinkAddress, LinksConstants<TLinkAddress>>INamedTypes<TLinkAddress>IComposedLinks<TLinkAddress>
- Inherited Members
-
LinksDecoratorBase<TLinkAddress>._constantsLinksDecoratorBase<TLinkAddress>._facadeLinksDecoratorBase<TLinkAddress>.FacadeLinksDecoratorBase<TLinkAddress>.ConstantsLinksOperatorBase<TLinkAddress>._linksLinksOperatorBase<TLinkAddress>.Links
- Extension Methods
Remarks
The map is an IAddressMap<TLinkAddress>: an OffsetAddressMap<TLinkAddress> moves a network out of the way of another, so a UnionLinksDecorator<TLinkAddress> of them shadows nothing, and an AddressTable<TLinkAddress> gives the addresses of another system addresses of our own. Strings from outside, such as UUIDs, are bound to links by LinksExternalIds.
A read that names an address that is not of the network below finds
nothing; a write that names one fails with ArgumentException.
The constants of the store (the null link, Any) are no addresses
and read the same on both sides.
Constructors
RemapLinksDecorator(INamedTypesLinks<TLinkAddress>, IAddressMap<TLinkAddress>)
public RemapLinksDecorator(INamedTypesLinks<TLinkAddress> links, IAddressMap<TLinkAddress> map)
Parameters
linksINamedTypesLinks<TLinkAddress>The network below.
mapIAddressMap<TLinkAddress>How its addresses read above.
Properties
Map
How the addresses of the network below read above.
public IAddressMap<TLinkAddress> Map { get; }
Property Value
- IAddressMap<TLinkAddress>
Methods
Claims(TLinkAddress)
Whether address is mapped to an address below.
public virtual bool Claims(TLinkAddress address)
Parameters
addressTLinkAddress
Returns
Count(IList<TLinkAddress>?)
Counts the restriction.
public override TLinkAddress Count(IList<TLinkAddress>? restriction)
Parameters
restrictionIList<TLinkAddress>The restriction.
Returns
- TLinkAddress
The link
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
Each(IList<TLinkAddress>?, ReadHandler<TLinkAddress>?)
Eaches the handler.
public override TLinkAddress Each(IList<TLinkAddress>? restriction, ReadHandler<TLinkAddress>? handler)
Parameters
restrictionIList<TLinkAddress>The restriction.
handlerReadHandler<TLinkAddress>The handler.
Returns
- TLinkAddress
The link
EnsureCreated(params TLinkAddress[])
Creates the links at addresses below, at the addresses they map to.
public virtual void EnsureCreated(params TLinkAddress[] addresses)
Parameters
addressesTLinkAddress[]
GetByName(string)
public virtual TLinkAddress GetByName(string name)
Parameters
namestring
Returns
- TLinkAddress
GetName(TLinkAddress)
public virtual string? GetName(TLinkAddress link)
Parameters
linkTLinkAddress
Returns
Outer(IList<TLinkAddress>?)
A link of the network below as it reads above.
protected IList<TLinkAddress>? Outer(IList<TLinkAddress>? link)
Parameters
linkIList<TLinkAddress>
Returns
- IList<TLinkAddress>
RemoveName(TLinkAddress)
public virtual void RemoveName(TLinkAddress link)
Parameters
linkTLinkAddress
SetName(TLinkAddress, string)
public virtual TLinkAddress SetName(TLinkAddress link, string name)
Parameters
linkTLinkAddressnamestring
Returns
- TLinkAddress
ToInner(TLinkAddress)
The address below of outer; throws when it is no address of the network below.
public TLinkAddress ToInner(TLinkAddress outer)
Parameters
outerTLinkAddress
Returns
- TLinkAddress
ToOuter(TLinkAddress)
The address above of inner; a constant reads the same.
public TLinkAddress ToOuter(TLinkAddress inner)
Parameters
innerTLinkAddress
Returns
- TLinkAddress
TryToInner(TLinkAddress, out TLinkAddress)
The address below of outer; false when it is no address of the network below. A constant reads the same.
public bool TryToInner(TLinkAddress outer, out TLinkAddress inner)
Parameters
outerTLinkAddressinnerTLinkAddress
Returns
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