Class RemoteLinks
The established uint remote store using the shared selected-address protocol.
public sealed class RemoteLinks : RemoteLinks<uint>, IDisposable, ITriplets<uint>, INamedTypesLinks<uint>, ILinks<uint>, ILinks<uint, LinksConstants<uint>>, INamedTypes<uint>
- Inheritance
-
RemoteLinks
- Implements
-
ILinks<uint>
- Inherited Members
- Extension Methods
Remarks
Code written against ITriplets<TLinkAddress>, TripletsQueryProcessor included, switches
from a local store to a server by swapping one value. Every call is one TripletsOperation round trip.
The doublets that store the triplets stay behind the server: over a server in triplet mode, the doublet calls
(Create, Update, Delete, Each) are refused like a failed connection; only
Exists, which counts, and the names keep working.
Constructors
RemoteLinks(LinksClient)
Uses an existing connection, which the store then owns.
public RemoteLinks(LinksClient client)
Parameters
clientLinksClient
Properties
Markers
The markers the server names; one the subject may not read is 0. Nothing else of this implementation
depends on them: the server applies the encoding.
public TripletMarkers<uint> Markers { get; }
Property Value
Methods
Connect(string, ILinoProtocol)
Connects to a server at an address written as host:port.
public static RemoteLinks Connect(string endPoint, ILinoProtocol protocol)
Parameters
endPointstringprotocolILinoProtocol
Returns
ConnectEndpoint(string, ILinoProtocol)
Connects to a server at any IPC endpoint, such as unix:/tmp/links.sock or shm:/tmp/links.
public static RemoteLinks ConnectEndpoint(string endpoint, ILinoProtocol protocol)
Parameters
endpointstringprotocolILinoProtocol
Returns
CountTriplets(TripletQuery<uint>)
The number of triplets that match query.
public int CountTriplets(TripletQuery<uint> query)
Parameters
queryTripletQuery<uint>
Returns
CountTripletsMatching(LinksRestriction)
Number of triplets matching restriction.
public uint CountTripletsMatching(LinksRestriction restriction)
Parameters
restrictionLinksRestriction
Returns
CreateTriplet(uint, uint, uint)
Creates (i: type from to) and returns i. type
must be a triplet; from and to triplets or the null link.
public uint CreateTriplet(uint type, uint from, uint to)
Parameters
Returns
CreateTripletPoint()
Creates a triplet (i: i 0 0) that is its own type.
public uint CreateTripletPoint()
Returns
CreateTripletPointAt(uint)
Makes the free address address a point: create has no way to name an address, a
substitution query does.
public void CreateTripletPointAt(uint address)
Parameters
addressuint
DeleteTriplet(uint)
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 IReadOnlyList<Triplet<uint>> DeleteTriplet(uint index)
Parameters
indexuint
Returns
DoubletUsages(uint)
How many other triplets use id: the doublets behind them are not on the wire.
public int DoubletUsages(uint id)
Parameters
iduint
Returns
EachTriplet(TripletQuery<uint>)
The triplets that match query, in the order of their addresses.
public IReadOnlyList<Triplet<uint>> EachTriplet(TripletQuery<uint> query)
Parameters
queryTripletQuery<uint>
Returns
Execute(LinksOperation)
Runs an established uint operation and returns its reply.
public IReadOnlyList<Link<string>> Execute(LinksOperation operation)
Parameters
operationLinksOperation
Returns
- IReadOnlyList<Link<string>>
ExecuteTriplets(TripletsOperation)
Runs one triplet operation on the server and returns its reply.
public IReadOnlyList<Link<string>> ExecuteTriplets(TripletsOperation operation)
Parameters
operationTripletsOperation
Returns
- IReadOnlyList<Link<string>>
GetTriplet(uint)
The triplet at index, null when it is not a triplet.
public Triplet<uint>? GetTriplet(uint index)
Parameters
indexuint
Returns
IsTriplet(uint)
Whether index is a triplet.
public bool IsTriplet(uint index)
Parameters
indexuint
Returns
ReceiveNotification(TimeSpan)
The next change pushed for a subscription of this store, waiting up to timeout for one;
null when none arrived in time.
public LinksNotification? ReceiveNotification(TimeSpan timeout)
Parameters
timeoutTimeSpan
Returns
ReceiveTripletNotification(TimeSpan)
The next change pushed to a subscription of this connection, waiting up to timeout for one;
null when none arrived in time.
public TripletsNotification? ReceiveTripletNotification(TimeSpan timeout)
Parameters
timeoutTimeSpan
Returns
RoleOf(uint)
A marker, a triplet, or null: the doublets that store the triplets are not on the wire, so they read as missing.
public DoubletRole? RoleOf(uint id)
Parameters
iduint
Returns
Subscribe(LinksRestriction)
Asks the server to push the changes other connections make to the links matching restriction
and returns the number of the subscription, which ReceiveNotification(TimeSpan) reports with them.
public uint Subscribe(LinksRestriction restriction)
Parameters
restrictionLinksRestriction
Returns
SubscribeTriplets(LinksRestriction)
Asks the server to push the changes other connections make to the triplets matching
restriction and returns the number of the subscription, which
ReceiveTripletNotification(TimeSpan) reports them with. Unsubscribe(uint) stops it.
public uint SubscribeTriplets(LinksRestriction restriction)
Parameters
restrictionLinksRestriction
Returns
TripletChanges(TripletsOperation)
Runs a create, update or delete and returns its changes.
public IReadOnlyList<TripletChange<uint>> TripletChanges(TripletsOperation operation)
Parameters
operationTripletsOperation
Returns
TripletsMatching(LinksRestriction)
Triplets matching restriction, ordered by index.
public IReadOnlyList<Triplet<uint>> TripletsMatching(LinksRestriction restriction)
Parameters
restrictionLinksRestriction
Returns
Unsubscribe(uint)
Stops a subscription; changes already pushed for it are still received.
public void Unsubscribe(uint subscription)
Parameters
subscriptionuint
UpdateTriplet(uint, uint, uint, uint)
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 Triplet<uint> UpdateTriplet(uint index, uint type, uint from, uint to)