Class TimestampedKeyWithHeadersQuery<K,V>
- Type Parameters:
K- Type of keysV- Type of values
- All Implemented Interfaces:
Query<ReadOnlyRecord<K,V>>
TimestampedKeyValueStoreWithHeaders.
This is the headers-aware parallel of TimestampedKeyQuery: it returns a
ReadOnlyRecord carrying the key, value, timestamp, and headers, whereas
TimestampedKeyQuery returns a ValueAndTimestamp
(value and timestamp only, no key or headers).
Headers are persisted and returned only when the store is backed by a native headers store,
i.e. built with a KIP-1271 WithHeaders byte-store supplier (e.g.
Stores.persistentTimestampedKeyValueStoreWithHeaders). A WithHeaders store built
over a legacy (non-headers) supplier cannot persist headers, so the result depends on who serves
the read: with caching enabled, a not-yet-evicted entry is served from the record cache and
returns the written value, timestamp, and headers (read-your-writes); once served from the
underlying store, the headers are gone. Over a timestamped legacy supplier (e.g.
Stores.persistentTimestampedKeyValueStore) the store-served read succeeds with empty
headers(); over a plain legacy supplier (e.g. Stores.persistentKeyValueStore),
which keeps no timestamp either, the store-served read has no representable timestamp and the
query fails with FailureReason.STORE_EXCEPTION.
Against a plain store not built with the WithHeaders builder at all, this query type is
unsupported and fails with FailureReason.UNKNOWN_QUERY_TYPE.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanThe flag whether to skip the cache or not during query evaluation.key()Return the key that was specified for this query.Specifies that the cache should be skipped during query evaluation.static <K,V> TimestampedKeyWithHeadersQuery <K, V> withKey(K key) Creates a query that will retrieve the record (value, timestamp, and headers) identified bykeyif it exists (ornullotherwise).
-
Method Details
-
withKey
Creates a query that will retrieve the record (value, timestamp, and headers) identified bykeyif it exists (ornullotherwise).- Type Parameters:
K- The type of the keyV- The type of the value that will be retrieved- Parameters:
key- The key to retrieve
-
skipCache
Specifies that the cache should be skipped during query evaluation. This means, that the query will always get forwarded to the underlying store. -
key
Return the key that was specified for this query.- Returns:
- The key that was specified for this query.
-
isSkipCache
public boolean isSkipCache()The flag whether to skip the cache or not during query evaluation.
-