英文:
How KeyValueStore allows write operations (Kafka Streams)
问题
我正在尝试理解Kafka Stream的StateStore
。我理解了一些基本概念。我查看了代码。
这是StateStore
的声明:
public interface StateStore { }
其中一个扩展了StateStore
的接口是KeyValueStore
。
这是KeyValueStore
的声明:
public interface KeyValueStore<K, V> extends StateStore, ReadOnlyKeyValueStore<K, V> { }
这是ReadOnlyKeyValueStore
的声明:
public interface ReadOnlyKeyValueStore<K, V> { }
我的疑问是:
public interface KeyValueStore<K, V> extends StateStore, ReadOnlyKeyValueStore<K, V> { }
KeyValueStore
如何允许以下操作(摘自其Java文档):
/**
- 支持put/get/delete和范围查询的键值存储。
- @param
键类型 - @param
值类型
*/
KeyValueStore
扩展了ReadOnlyKeyValueStore
。所以这是如何可能的?
可以有人帮助理解吗?
英文:
I am trying to understand kafka stream's Statestore
. I understood some basics of it. I looked into the code.
Here is the declaration of StateStore
:
public interface StateStore { }
One of the interfaces which extends StateStore
is KeyValueStore
.
Here is the declaration of KeyValueStore
:
public interface KeyValueStore<K, V> extends StateStore, ReadOnlyKeyValueStore<K, V> { }
Here is the declaration of ReadOnlyKeyValueStore
:
public interface ReadOnlyKeyValueStore<K, V> { }
My doubt is this:
public interface KeyValueStore<K, V> extends StateStore, ReadOnlyKeyValueStore<K, V> { }
How KeyValueStore
is allowing the following operations (taken from its java-doc_):
>/**
- A key-value store that supports put/get/delete and range queries.
* - @param <K> The key type
- @param <V> The value type
*/
KeyValueStore
is extending ReadOnlyKeyValueStore
. So how is it possible?
Can anyone help understand this?
答案1
得分: 2
这只是一个接口,没有明确限制写入能力的逻辑。
唯一的区别是添加了put和delete方法。通过继承只读存储接口获得了get方法。
英文:
It's just an interface, there's no logic that explicitly limits the ability to write.
The only difference is the addition of the put and delete method(s). The get method is obtained through inheritance of the read-only store interface
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论