我正在尝试理解卡夫卡流的
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-doc_):
/**
KeyValueStore
正在延伸ReadOnlyKeyValueStore
。那怎么可能呢?
它只是一个接口,没有明确限制编写能力的逻辑。
唯一的区别是添加了 put 和 delete 方法。 get方法是通过继承只读store接口来获取的