Class TripletsPermissionsDecorator<TLinkAddress>
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
Permissions on triplets (issues #149 and #152): the same rules as on
doublets, judged on the triplet as a whole. The Rust counterpart is
link_cli::PermissionsDecorator over a Triplets store.
public class TripletsPermissionsDecorator<TLinkAddress> : PermissionsDecorator<TLinkAddress>, IReferencedLinks<TLinkAddress>, ITriplets<TLinkAddress>, INamedTypesLinks<TLinkAddress>, ILinks<TLinkAddress>, ILinks<TLinkAddress, LinksConstants<TLinkAddress>>, INamedTypes<TLinkAddress> where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>
Type Parameters
TLinkAddress
- Inheritance
-
LinksOperatorBase<TLinkAddress>LinksDecoratorBase<TLinkAddress>PermissionsDecorator<TLinkAddress>TripletsPermissionsDecorator<TLinkAddress>
- Implements
-
IReferencedLinks<TLinkAddress>ITriplets<TLinkAddress>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
Remarks
The doublets of a triplet are not the subject's business. A rule on the
type Note says nothing about the wrappers and pairs that happen to
store the parts of a note, so a PermissionsDecorator<TLinkAddress>
under TripletsOverDoublets<TLinkAddress> would hide them and
refuse to write them. This one goes above instead, over the
ITriplets<TLinkAddress> store, and asks the policy only about
the outer doublet (index: type …):
- a triplet the subject may not read does not exist for the subject, and neither does anything that is not a triplet;
- creating needs the right to create and to write the type;
- every part needs the right to refer to it (issue #161): without it an unreadable part answers as a missing one, after the write check, and a part the triplet already holds may stay;
- choosing the address of a new point is a reference too;
- updating needs the right to write the triplet as it is and as it will be;
- deleting needs the right to write every triplet the delete takes along, or nothing is deleted;
- a point the subject created, still only its own type, is the subject's: that is what a substitution query reserves before it sets the type.
Constructors
TripletsPermissionsDecorator(ITriplets<TLinkAddress>, IPermissionPolicy<TLinkAddress>, Func<TLinkAddress>)
public TripletsPermissionsDecorator(ITriplets<TLinkAddress> triplets, IPermissionPolicy<TLinkAddress> policy, Func<TLinkAddress> subject)
Parameters
tripletsITriplets<TLinkAddress>The triplets below.
policyIPermissionPolicy<TLinkAddress>Who may read and write what.
subjectFunc<TLinkAddress>The subject, asked at every call (the null link is a guest).
Properties
Markers
The markers of the encoding.
public TripletMarkers<TLinkAddress> Markers { get; }
Property Value
- TripletMarkers<TLinkAddress>
Methods
CountTriplets(TripletQuery<TLinkAddress>)
The number of triplets that match query.
public virtual int CountTriplets(TripletQuery<TLinkAddress> query)
Parameters
queryTripletQuery<TLinkAddress>
Returns
CreateTriplet(TLinkAddress, TLinkAddress, TLinkAddress)
Creates (i: type from to) and returns i. type
must be a triplet; from and to triplets or the null link.
public virtual TLinkAddress CreateTriplet(TLinkAddress type, TLinkAddress from, TLinkAddress to)
Parameters
typeTLinkAddressfromTLinkAddresstoTLinkAddress
Returns
- TLinkAddress
CreateTripletPoint()
Creates a triplet (i: i 0 0) that is its own type.
public virtual TLinkAddress CreateTripletPoint()
Returns
- TLinkAddress
CreateTripletPointAt(TLinkAddress)
Makes the free address address a triplet (address: address 0 0) that is its own type.
public virtual void CreateTripletPointAt(TLinkAddress address)
Parameters
addressTLinkAddress
DeleteTriplet(TLinkAddress)
Deletes the triplet at index and every triplet that uses
a deleted one as its type, from or to; returns them all, index first.
public virtual IReadOnlyList<Triplet<TLinkAddress>> DeleteTriplet(TLinkAddress index)
Parameters
indexTLinkAddress
Returns
- IReadOnlyList<Triplet<TLinkAddress>>
DoubletUsages(TLinkAddress)
How many other doublets use the doublet id as their source or target.
public virtual int DoubletUsages(TLinkAddress id)
Parameters
idTLinkAddress
Returns
EachTriplet(TripletQuery<TLinkAddress>)
The triplets that match query, in the order of their addresses.
public virtual IReadOnlyList<Triplet<TLinkAddress>> EachTriplet(TripletQuery<TLinkAddress> query)
Parameters
queryTripletQuery<TLinkAddress>
Returns
- IReadOnlyList<Triplet<TLinkAddress>>
GetTriplet(TLinkAddress)
The triplet at index, null when it is not a triplet.
public virtual Triplet<TLinkAddress>? GetTriplet(TLinkAddress index)
Parameters
indexTLinkAddress
Returns
- Triplet<TLinkAddress>?
IsTriplet(TLinkAddress)
Whether index is a triplet.
public virtual bool IsTriplet(TLinkAddress index)
Parameters
indexTLinkAddress
Returns
Owns(IList<TLinkAddress>)
Whether link is the subject's own: created through this view and still without a type.
public override bool Owns(IList<TLinkAddress> link)
Parameters
linkIList<TLinkAddress>
Returns
Remarks
Read as triplets, a point that is only its own type has no type yet either.
ReferenceIsTriplet(TLinkAddress)
Whether a reference to index names a triplet: the same as IsTriplet(TLinkAddress),
but for a view that hides triplets, where one the subject may refer to counts as well (issue #161).
public virtual bool ReferenceIsTriplet(TLinkAddress index)
Parameters
indexTLinkAddress
Returns
RoleOf(TLinkAddress)
What the doublet id is in the encoding; null when it is missing.
public virtual DoubletRole? RoleOf(TLinkAddress id)
Parameters
idTLinkAddress
Returns
UpdateTriplet(TLinkAddress, TLinkAddress, TLinkAddress, TLinkAddress)
Makes the triplet at index (index: type from to),
keeping its address, and returns the triplet as it was. The pair it no
longer uses is collected when nothing else uses it.
public virtual Triplet<TLinkAddress> UpdateTriplet(TLinkAddress index, TLinkAddress type, TLinkAddress from, TLinkAddress to)
Parameters
indexTLinkAddresstypeTLinkAddressfromTLinkAddresstoTLinkAddress
Returns
- Triplet<TLinkAddress>