SharedSubscriptionRegistry

StockSharp.Messages

Tracks who holds a subscription that is shared: one upstream subscription per key, opened by the first holder to ask for it and given up after the last one lets go.

方法

Add
public Entry<TKey, THolder, THolderData, TPayload> Add(TKey key, THolder holder, THolderData data, Func<CachedSynchronizedDictionary<THolder, THolderData>, TPayload> createPayload, bool isOpener)
result = sharedSubscriptionRegistry.Add(key, holder, data, createPayload, isOpener)

Records that holds the subscription named by , creating it if it is not there yet.

key
What makes two requests the same subscription.
holder
The holder taking it.
data
What this holder asked for.
createPayload
Builds what to keep about the subscription, for a new one, from the holders it will have.
isOpener
when this holder created the subscription and the caller has to open it upstream.

返回值: The entry, or when this holder already holds a subscription and is asking twice.

Add
public Entry<TKey, THolder, THolderData, TPayload> Add(TKey key, THolder holder, Func<CachedSynchronizedDictionary<THolder, THolderData>, TPayload> createPayload, bool isOpener)
result = sharedSubscriptionRegistry.Add(key, holder, createPayload, isOpener)

Records that holds the subscription named by , for a caller that keeps nothing about each holder beyond the fact that it is one.

key
What makes two requests the same subscription.
holder
The holder taking it.
createPayload
Builds what to keep about the subscription, for a new one, from the holders it will have.
isOpener
when this holder created the subscription and the caller has to open it upstream.

返回值: The entry, or when this holder already holds a subscription and is asking twice.

Clear
public void Clear()
sharedSubscriptionRegistry.Clear()

Forgets everything.

Drop(SharedSubscriptionRegistry{)

Gives up a whole subscription at once, holders and all, for one that turned out never to have been opened.

entry
The subscription to give up.
Entries
public IReadOnlyCollection<Entry<TKey, THolder, THolderData, TPayload>> Entries()
result = sharedSubscriptionRegistry.Entries()

Everything currently tracked.

返回值: The entries.

Holders
public IReadOnlyCollection<THolder> Holders()
result = sharedSubscriptionRegistry.Holders()

Everyone currently holding a subscription, including holders of one that can no longer be found by its key.

返回值: The holders.

Remove(T, SharedSubscriptionRegistry{) : bool

Drops one holder.

holder
The holder letting go.
entry
The subscription it was holding, whether or not it was the last.

返回值: when it was the last holder, so the caller has to give the subscription up upstream.

RemoveWhere
public IReadOnlyCollection<Entry<TKey, THolder, THolderData, TPayload>> RemoveWhere(Func<THolder, bool> match)
result = sharedSubscriptionRegistry.RemoveWhere(match)

Drops every holder the caller recognises as its own - a client session that went away without unsubscribing holds everything it took until this is called.

match
Recognises the holders to drop.

返回值: The subscriptions that lost their last holder.

TryGetByHolder(T, SharedSubscriptionRegistry{) : bool

Finds the shared subscription a holder holds.

holder
The holder.
entry
The entry, when it holds one.

返回值: when it holds one.

TryGetByKey(T, SharedSubscriptionRegistry{) : bool

Finds a shared subscription by what makes it that subscription.

key
What makes two requests the same subscription.
entry
The entry, when there is one.

返回值: when it exists.

Unkey(SharedSubscriptionRegistry{)

Takes a subscription out of the key index while leaving its holders addressable, for one that stopped and must not be joined again although those who held it are still being answered.

entry
The subscription.