Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • we propose a public class, MultiVersionedKeyQuery
  • and a public enum ResultOrder
  • Moreover, the public interface VersionedRecordIterator is added to iterate over different values that are returned from a single-key query (each value corresponds to a timestamp). 
  • In addition, a new method is added to the VersionedKeyValueStore interface to support single-key_multi-timestamp queries.
  • Finally, a field called validTo is added to the VersionedRecord class to enable us representing tombstones as well. 

...

To be able to list the tombstones, the validTo Optional field is added to the VersionedRecord class. The default value of validTo is positive infinity is Optional.empty() which means the record is still valid.

Code Block
languagejava
firstline1
titleVersionedRecord.java
linenumberstrue
package org.apache.kafka.streams.state;

public final class VersionedRecord<V> {

 	/**
     * Create a new {@link VersionedRecord} instance. {@code value} cannot be {@code null}.
     *
     * @param value      the value
     * @param timestamp  the timestamp
     */
    public VersionedRecord(final V value, final long timestamp) {
        this.value = Objects.requireNonNull(value);
        this.timestamp = timestamp;
        this.validTo = Long.MAX_VALUEOptional.empty();
    }      
	
	/**
     * Create a new {@link VersionedRecord} instance. {@code value} cannot be {@code null}.
     *
     * @param value      The value
     * @param timestamp  The timestamp
     * @param validTo    The exclusive upper bound of the validity interval
     */
     public VersionedRecord(final V value, final long timestamp, final longOptional<Long> validTo);


    /**
     * Returns the {@code validTo} 
     */
     public longOptional<Long> validTo();
}


For single-key queries, MultiVersionedKeyQuery and VersionedRecordIterator classes will be used.

...