Replies: 6 comments 5 replies
-
Or we could make Filters naturally scoped to a VirtualCluster so it's not something they pick up from the Context while filtering but something known at FIlter construction time? |
Beta Was this translation helpful? Give feedback.
-
I had been envisaging doing something like 1 as a bootstrap exercise when I self assigned kroxylicious/topic-encryption#2 to see how that played out in practice. Probably doing something along the same lines for a another filter or two to try and establish a common pattern before looking at something like 2. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure about topic scoped state. What would be the use-case? The other scopes make sense to me. |
Beta Was this translation helpful? Give feedback.
-
FYI, for Vert-x I've modified an existing write-combining primitive construct to be more "thread-per-core" non-blocking friendly, see TLDR it's a sort of cooperative lock where the winner to enter the lock execute concurrent/racy actions submitted by other threads.
in both cases, read path can be wait free |
Beta Was this translation helpful? Give feedback.
-
Mutable shared state is hard. The use case of wanting to cache information per topic is likely to be common. There might be similar cases for storing information about things like consumer groups. Here are some random thoughts which may, or may not be useful:
|
Beta Was this translation helpful? Give feedback.
-
We don't have time to address this, so let's close it. |
Beta Was this translation helpful? Give feedback.
-
Currently users can store state in their Filter, or perhaps use ThreadLocals or static state to share access to some threadsafe objects. If we wanted to scope that state to be shared only within one VirtualCluster then we currently don't have a mechanism to know what virtual cluster the current context is happening in.
A concrete example is topic encryption, we may have a set of topic policies and key manager definitions that are relevant to one Virtual Cluster only (because the targeted topic names could be used in another unrelated virtual cluster). We could potentially share an Encryption Module and a map from topic id to topic name across instances of the encrypt/decrypt filters and save having to populate them all the time.
Some ideas.
context.metadata().virtualClusterName()
orcontext.virtualCluster().name()
. Then the Filter would implement it's own staticConcurrentHashMap<String, State>
context.state().virtualCluster().getOrCreate("xyz", () -> { new State()}, State.class)
Relevant to kroxylicious/topic-encryption#2
Beta Was this translation helpful? Give feedback.
All reactions