public final class AuthorisedChronicleQueueView<T,M> extends Object implements QueueView<T,M>, MapView<T,M>, SubAssetFactory, Closeable
QueueView.Excerpt<T,M>, QueueView.Tailer<T,M>
Constructor and Description |
---|
AuthorisedChronicleQueueView(@NotNull RequestContext context,
@NotNull Asset asset,
@NotNull ChronicleQueueView<T,M> queueView) |
Modifier and Type | Method and Description |
---|---|
<V> @NotNull Function<T,V> |
andThen(@NotNull Function<? super M,? extends V> after) |
M |
apply(T t) |
<A,R> R |
applyTo(@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<MapView<T,M>,A,R> function,
A arg)
Apply a function to an Updatable which is assumed to not change the visited in any significant way.
|
<R> R |
applyTo(@NotNull net.openhft.chronicle.core.util.SerializableFunction<MapView<T,M>,R> function)
Apply a function to an Updatable which is assumed to not change the visited in any significant way.
|
<T1,R> R |
applyToKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,R> function,
T1 argument)
Apply a function which takes an argument.
|
<R> R |
applyToKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<M,R> function)
Apply a function to the visitable and return the result.
|
Asset |
asset() |
void |
asyncUpdate(@NotNull net.openhft.chronicle.core.util.SerializableUpdater<MapView<T,M>> updateFunction)
Update an Updatable potentially asynchronously.
|
<A> void |
asyncUpdate(@NotNull net.openhft.chronicle.core.util.SerializableUpdaterWithArg<MapView<T,M>,A> updateFunction,
A arg)
Update an Updatable potentially asynchronously.
|
<T1> void |
asyncUpdateKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,M> updateFunction,
T1 argument)
Apply a function to visitable potentially asynchronously.
|
void |
asyncUpdateKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<M,M> updateFunction)
Apply a function to visitable potentially asynchronously.
|
void |
clear() |
void |
close() |
<V> @NotNull Function<V,M> |
compose(@NotNull Function<? super V,? extends T> before) |
M |
compute(T key,
BiFunction<? super T,? super M,? extends M> remappingFunction) |
M |
computeIfAbsent(T key,
Function<? super T,? extends M> mappingFunction) |
M |
computeIfPresent(T key,
BiFunction<? super T,? super M,? extends M> remappingFunction) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
<E> @Nullable Asset |
createSubAsset(@NotNull VanillaAsset vanillaAsset,
String name,
Class<E> valueType) |
@NotNull EntrySetView<T,M> |
entrySet() |
boolean |
equals(Object o) |
@Nullable QueueView.Excerpt<T,M> |
excerpt(long index)
|
void |
forEach(BiConsumer<? super T,? super M> action) |
M |
get(Object key) |
M |
getAndPut(T key,
M value)
Explicitly get the old value before putting a new one.
|
M |
getAndRemove(T key)
Explicitly get the old value before removing.
|
M |
getOrDefault(Object key,
M defaultValue) |
M |
getUsing(T key,
Object using)
Obtain a value using a mutable buffer provided.
|
int |
hashCode() |
boolean |
isClosed() |
boolean |
isEmpty() |
boolean |
keyedView()
Returns if this is a keyed asset, i.e.
|
@NotNull KeySetView<T> |
keySet() |
Class<T> |
keyType() |
long |
longSize() |
M |
merge(T key,
M value,
BiFunction<? super M,? super M,? extends M> remappingFunction) |
QueueView.Excerpt<T,M> |
next(long index)
Returns the
QueueView.Excerpt immediately following the Excerpt at a given index or null if no such Excerpt exists. |
@Nullable QueueView.Excerpt<T,M> |
next(T topic)
Returns the next unread message from the tailer with the provided
topic or null if no such Excerpt exists. |
void |
publish(T topic,
M message)
Publish the given
message to the provided topic . |
long |
publishAndIndex(T topic,
M message)
Publish the given
message to the provided topic . |
@NotNull Publisher<M> |
publisher(T topic)
Creates and returns a new Publisher for the provided
topic . |
M |
put(T key,
M value) |
void |
putAll(@NotNull Map<? extends T,? extends M> m) |
M |
putIfAbsent(T key,
M value) |
Reference<M> |
referenceFor(T key)
Obtain a reference the value for a key
|
void |
registerKeySubscriber(@NotNull Subscriber<? super T> subscriber)
Add a Subscription for the keys changed on this Map
|
void |
registerKeySubscriber(@NotNull Subscriber<? super T> subscriber,
@NotNull Filter filter,
@NotNull Set<RequestContext.Operation> contextOperations)
Add a Subscription for the keys changed on this Map
|
void |
registerSubscriber(@NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber)
Add a Subscription for the MapEvents triggered by changes on this Map.
|
void |
registerSubscriber(@NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber,
@NotNull Filter<? extends MapEvent<? super T,? super M>> filter,
@NotNull Set<RequestContext.Operation> contextOperations)
Add a Subscription for the MapEvents triggered by changes on this Map.
|
void |
registerSubscriber(T topic,
@NotNull Subscriber<? super M> subscriber)
Registers and associates the provided
subscriber with the provided topic . |
void |
registerTopicSubscriber(@NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
Add a subscription to this group.
|
M |
remove(Object key) |
boolean |
remove(@NotNull Object key,
Object value) |
M |
replace(T key,
M value) |
boolean |
replace(T key,
M oldValue,
M newValue) |
void |
replaceAll(BiFunction<? super T,? super M,? extends M> function) |
void |
set(T key,
M element) |
int |
size() |
<R> R |
syncUpdate(@NotNull net.openhft.chronicle.core.util.SerializableUpdater<MapView<T,M>> updateFunction,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<MapView<T,M>,R> returnFunction)
Apply a function to update an Updatable and apply a second function to derive some information from it.
|
<UA,RA,R> R |
syncUpdate(@NotNull net.openhft.chronicle.core.util.SerializableUpdaterWithArg<MapView<T,M>,UA> updateFunction,
UA ua,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<MapView<T,M>,RA,R> returnFunction,
RA returnArgument)
Apply a function to update an Updatable and apply a second function to derive some information from it.
|
<T1,A,R> R |
syncUpdateKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,M> updateFunction,
T1 updateArgument,
@NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,A,R> returnFunction,
A returnArgument)
Apply a function to update the state of a visible, and apply a function to return a result object synchronously.
|
<R> R |
syncUpdateKey(T key,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<M,M> updateFunction,
@NotNull net.openhft.chronicle.core.util.SerializableFunction<M,R> returnFunction)
Apply a function to update the state of a visible, and apply a function to return a result object synchronously.
|
void |
throwExceptionIfClosed() |
@Nullable Object |
underlying() |
void |
unregisterSubscriber(T topic,
@NotNull Subscriber<? super M> subscriber)
Unregisters and disassociates the provided
subscriber from the provided topic . |
void |
unregisterTopicSubscriber(@NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
Unregister a TopicSubscriber
|
void |
unregisterTopicSubscriber(T topic,
@NotNull TopicSubscriber<? super T,? super M> topicSubscriber) |
@NotNull Collection<M> |
values() |
Class<M> |
valueType() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
registerTopicSubscriber
public AuthorisedChronicleQueueView(@NotNull @NotNull RequestContext context, @NotNull @NotNull Asset asset, @NotNull @NotNull ChronicleQueueView<T,M> queueView)
@NotNull public @NotNull KeySetView<T> keySet()
public void throwExceptionIfClosed()
@NotNull public @NotNull EntrySetView<T,M> entrySet()
@NotNull public M getUsing(T key, Object using)
MapView
public void registerTopicSubscriber(@NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
TopicPublisher
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerTopicSubscriber
in interface MapView<T,M>
registerTopicSubscriber
in interface TopicPublisher<T,M>
topicSubscriber
- to listen to events.public void unregisterTopicSubscriber(@NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
TopicPublisher
This method is asynchronous and the provided subscriber will be prevented from receiving events as some later unspecified time.
unregisterTopicSubscriber
in interface TopicPublisher<T,M>
topicSubscriber
- to unregisterpublic void registerKeySubscriber(@NotNull @NotNull Subscriber<? super T> subscriber)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerKeySubscriber
in interface MapView<T,M>
subscriber
- to addpublic void registerKeySubscriber(@NotNull @NotNull Subscriber<? super T> subscriber, @NotNull @NotNull Filter filter, @NotNull @NotNull Set<RequestContext.Operation> contextOperations)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerKeySubscriber
in interface MapView<T,M>
subscriber
- to addfilter
- a list of filter operationscontextOperations
- which optional operations to consider (e.g. bootstrap and ending after bootstrap)public void registerSubscriber(@NotNull @NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber, @NotNull @NotNull Filter<? extends MapEvent<? super T,? super M>> filter, @NotNull @NotNull Set<RequestContext.Operation> contextOperations)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface MapView<T,M>
subscriber
- the subscriber to the subscriptionfilter
- to apply on keys and valuescontextOperations
- which optional operations to consider (e.g. bootstrap and ending after bootstrap)public void unregisterSubscriber(@NotNull T topic, @NotNull @NotNull Subscriber<? super M> subscriber)
TopicPublisher
subscriber
from the provided topic
.
This method is asynchronous and the provided subscriber will be prevented from receiving events as some later unspecified time.
unregisterSubscriber
in interface TopicPublisher<T,M>
topic
- to disassociates from the given subscriber
subscriber
- to unregisterpublic Reference<M> referenceFor(T key)
MapView
referenceFor
in interface MapView<T,M>
key
- to bind the reference topublic long longSize()
@Nullable public M getAndPut(T key, M value)
MapView
@Nullable public M getAndRemove(T key)
MapView
getAndRemove
in interface MapView<T,M>
key
- to removepublic void unregisterTopicSubscriber(@NotNull T topic, @NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
@NotNull public @NotNull Publisher<M> publisher(@NotNull T topic)
TopicPublisher
topic
.publisher
in interface TopicPublisher<T,M>
topic
- to create a Publisher fortopic
public void registerSubscriber(@NotNull T topic, @NotNull @NotNull Subscriber<? super M> subscriber)
TopicPublisher
subscriber
with the provided topic
.
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface TopicPublisher<T,M>
topic
- to associate with the given subscriber
subscriber
- to register@Nullable public @Nullable QueueView.Excerpt<T,M> excerpt(long index)
QueueView
QueueView.Excerpt
at a given index
or null
if no such Excerpt exists.
If the provided index
is 0, then the excerpt at the first index is returned
If the index is not a valid index, the operation is undefined.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
excerpt
in interface QueueView<T,M>
index
- the address of the exceptQueueView.Excerpt
at a given index or null
if no such Excerpt existspublic QueueView.Excerpt<T,M> next(long index)
QueueView
QueueView.Excerpt
immediately following the Excerpt at a given index
or null
if no such Excerpt exists. This method
is useful for continuously reading Excerpts in an environment where the client can switch between several servers.
In other words, assuming that the queue has not rolled, returns an excerpt who's index is the provided index
+ 1
If the provided index
is 0, then the excerpt at the second index is returned
If the index is not a valid index, the operation is undefined.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
next
in interface QueueView<T,M>
index
- the address of a previous except for which the next Excerpt is to be retrievedQueueView.Excerpt
immediately following the Excerpt at a given index or null
if no such Excerpt exists@Nullable public @Nullable QueueView.Excerpt<T,M> next(@NotNull T topic)
QueueView
topic
or null
if no such Excerpt exists.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
public void set(T key, M element)
set
in interface KeyedVisitable<T,M>
key
- to set within this collection.element
- replace the current state of the visitable Assetpublic void publish(@NotNull T topic, @NotNull M message)
TopicPublisher
message
to the provided topic
.publish
in interface TopicPublisher<T,M>
topic
- to publish tomessage
- to publish.public long publishAndIndex(@NotNull T topic, @Nullable M message)
QueueView
message
to the provided topic
.publishAndIndex
in interface QueueView<T,M>
topic
- to publish tomessage
- to publish.public boolean containsKey(Object key)
containsKey
in interface Map<T,M>
public boolean containsValue(Object value)
containsValue
in interface Map<T,M>
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void registerSubscriber(@NotNull @NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface MapView<T,M>
subscriber
- the subscriber to the subscription@Nullable public <E> @Nullable Asset createSubAsset(@NotNull @NotNull VanillaAsset vanillaAsset, String name, Class<E> valueType)
createSubAsset
in interface SubAssetFactory
public M putIfAbsent(@NotNull T key, M value)
putIfAbsent
in interface ConcurrentMap<T,M>
putIfAbsent
in interface Map<T,M>
public Asset asset()
@Nullable public @Nullable Object underlying()
underlying
in interface Assetted<Object>
public boolean keyedView()
KeyedView
public int size()
public M getOrDefault(Object key, M defaultValue)
getOrDefault
in interface ConcurrentMap<T,M>
getOrDefault
in interface Map<T,M>
public void forEach(BiConsumer<? super T,? super M> action)
public void replaceAll(BiFunction<? super T,? super M,? extends M> function)
replaceAll
in interface ConcurrentMap<T,M>
replaceAll
in interface Map<T,M>
public M computeIfAbsent(T key, Function<? super T,? extends M> mappingFunction)
computeIfAbsent
in interface ConcurrentMap<T,M>
computeIfAbsent
in interface Map<T,M>
public M computeIfPresent(T key, BiFunction<? super T,? super M,? extends M> remappingFunction)
computeIfPresent
in interface ConcurrentMap<T,M>
computeIfPresent
in interface Map<T,M>
public boolean equals(Object o)
public int hashCode()
@Nullable public <R> R applyTo(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<MapView<T,M>,R> function)
Updatable
public void asyncUpdate(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableUpdater<MapView<T,M>> updateFunction)
Updatable
asyncUpdate
in interface Updatable<MapView<T,M>>
updateFunction
- to apply.@Nullable public <R> R syncUpdate(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableUpdater<MapView<T,M>> updateFunction, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<MapView<T,M>,R> returnFunction)
Updatable
syncUpdate
in interface Updatable<MapView<T,M>>
R
- data type to return.updateFunction
- to apply the update.returnFunction
- to derive some data@Nullable public <A,R> R applyTo(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<MapView<T,M>,A,R> function, A arg)
Updatable
public <A> void asyncUpdate(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableUpdaterWithArg<MapView<T,M>,A> updateFunction, A arg)
Updatable
asyncUpdate
in interface Updatable<MapView<T,M>>
A
- argument type.updateFunction
- to apply.arg
- argument to apply@Nullable public <UA,RA,R> R syncUpdate(@NotNull @NotNull net.openhft.chronicle.core.util.SerializableUpdaterWithArg<MapView<T,M>,UA> updateFunction, UA ua, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<MapView<T,M>,RA,R> returnFunction, RA returnArgument)
Updatable
syncUpdate
in interface Updatable<MapView<T,M>>
UA
- update argument typeRA
- return argument typeR
- return typeupdateFunction
- to apply the update.ua
- update argumentreturnFunction
- to derive some datareturnArgument
- return argument@Nullable public <R> R applyToKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<M,R> function)
KeyedVisitable
applyToKey
in interface KeyedVisitable<T,M>
R
- data type to return.key
- to visit within this collection.function
- to apply e.g. call a getterpublic void asyncUpdateKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<M,M> updateFunction)
KeyedVisitable
asyncUpdateKey
in interface KeyedVisitable<T,M>
key
- to visit within this collection.updateFunction
- to update the state of the visibility.@Nullable public <R> R syncUpdateKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<M,M> updateFunction, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableFunction<M,R> returnFunction)
KeyedVisitable
syncUpdateKey
in interface KeyedVisitable<T,M>
R
- data type to return.key
- to update within this collection.updateFunction
- update to apply to the value.returnFunction
- derive an object to return@Nullable public <T1,R> R applyToKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,R> function, T1 argument)
KeyedVisitable
applyToKey
in interface KeyedVisitable<T,M>
T1
- type of the argumentR
- type of the return value.key
- to visit within this collection.function
- to applyargument
- for the functions use.public <T1> void asyncUpdateKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,M> updateFunction, T1 argument)
KeyedVisitable
asyncUpdateKey
in interface KeyedVisitable<T,M>
T1
- type of the argumentkey
- to update within this collectionupdateFunction
- to update the state of the visitable.argument
- for the functions use.@Nullable public <T1,A,R> R syncUpdateKey(T key, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,T1,M> updateFunction, @Nullable T1 updateArgument, @NotNull @NotNull net.openhft.chronicle.core.util.SerializableBiFunction<M,A,R> returnFunction, @Nullable A returnArgument)
KeyedVisitable
syncUpdateKey
in interface KeyedVisitable<T,M>
T1
- update argument type.A
- return argument type.R
- data type to return.key
- to update within this collectionupdateFunction
- update to apply to the value.updateArgument
- for the update function to use.returnFunction
- derive an object to returnreturnArgument
- for the return value function to use@NotNull public <V> @NotNull Function<V,M> compose(@NotNull @NotNull Function<? super V,? extends T> before)
@NotNull public <V> @NotNull Function<T,V> andThen(@NotNull @NotNull Function<? super M,? extends V> after)
public boolean isClosed()
isClosed
in interface net.openhft.chronicle.core.io.QueryCloseable
Copyright © 2021. All rights reserved.