tuweni / org.apache.tuweni.kv / ProxyKeyValueStore / <init>

<init>

ProxyKeyValueStore(store: KeyValueStore<E, R>, unproxyKey: (E) -> K, proxyKey: (K) -> E, unproxyValue: (R) -> V, proxyValue: (K, V) -> R, coroutineContext: CoroutineContext = store.coroutineContext)

A store used as a proxy for another store.

For example, we may want to store rich objects and transform them to a lower-level form, or reuse the same store across multiple usages.

Parameters

store - the key/value store

unproxyKey - function to transform the key from the proxied store to the outer store

proxyKey - function to transform the key from this proxy to the proxied store

unproxyValue - function to transform the value from the proxied store to the outer store

proxyValue - function to transform the value from this proxy to the proxied store

coroutineContext - the kotlin coroutine context