Class AbstractRocksDBSegmentedBytesStore<S extends Segment>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> all()
      Gets all the key-value pairs in the existing windows.
      void close()
      Close the storage engine.
      KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetch​(org.apache.kafka.common.utils.Bytes key, long from, long to)
      Fetch all records from the segmented store with the provided key and time range from all existing segments
      KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetch​(org.apache.kafka.common.utils.Bytes keyFrom, org.apache.kafka.common.utils.Bytes keyTo, long from, long to)
      Fetch all records from the segmented store in the provided key range and time range from all existing segments
      KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetchAll​(long timeFrom, long timeTo)
      Gets all the key-value pairs that belong to the windows within in the given time range.
      void flush()
      Flush any cached data
      byte[] get​(org.apache.kafka.common.utils.Bytes key)
      Get the record from the store with the given key.
      void init​(ProcessorContext context, StateStore root)
      Initializes this state store.
      boolean isOpen()
      Is this store open for reading and writing
      String name()
      The name of this store.
      boolean persistent()
      Return if the storage is persistent or not.
      void put​(org.apache.kafka.common.utils.Bytes key, byte[] value)
      Write a new value to the store with the provided key.
      void remove​(org.apache.kafka.common.utils.Bytes key)
      Remove the record with the provided key.
    • Method Detail

      • fetch

        public KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetch​(org.apache.kafka.common.utils.Bytes key,
                                                                                        long from,
                                                                                        long to)
        Description copied from interface: SegmentedBytesStore
        Fetch all records from the segmented store with the provided key and time range from all existing segments
        Specified by:
        fetch in interface SegmentedBytesStore
        Parameters:
        key - the key to match
        from - earliest time to match
        to - latest time to match
        Returns:
        an iterator over key-value pairs
      • fetch

        public KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetch​(org.apache.kafka.common.utils.Bytes keyFrom,
                                                                                        org.apache.kafka.common.utils.Bytes keyTo,
                                                                                        long from,
                                                                                        long to)
        Description copied from interface: SegmentedBytesStore
        Fetch all records from the segmented store in the provided key range and time range from all existing segments
        Specified by:
        fetch in interface SegmentedBytesStore
        Parameters:
        keyFrom - The first key that could be in the range
        keyTo - The last key that could be in the range
        from - earliest time to match
        to - latest time to match
        Returns:
        an iterator over key-value pairs
      • all

        public KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> all()
        Description copied from interface: SegmentedBytesStore
        Gets all the key-value pairs in the existing windows.
        Specified by:
        all in interface SegmentedBytesStore
        Returns:
        an iterator over windowed key-value pairs <Windowed<K>, value>
      • fetchAll

        public KeyValueIterator<org.apache.kafka.common.utils.Bytes,​byte[]> fetchAll​(long timeFrom,
                                                                                           long timeTo)
        Description copied from interface: SegmentedBytesStore
        Gets all the key-value pairs that belong to the windows within in the given time range.
        Specified by:
        fetchAll in interface SegmentedBytesStore
        Parameters:
        timeFrom - the beginning of the time slot from which to search
        timeTo - the end of the time slot from which to search
        Returns:
        an iterator over windowed key-value pairs <Windowed<K>, value>
      • remove

        public void remove​(org.apache.kafka.common.utils.Bytes key)
        Description copied from interface: SegmentedBytesStore
        Remove the record with the provided key. The key should be a composite of the record key, and the timestamp information etc as described by the SegmentedBytesStore.KeySchema
        Specified by:
        remove in interface SegmentedBytesStore
        Parameters:
        key - the segmented key to remove
      • put

        public void put​(org.apache.kafka.common.utils.Bytes key,
                        byte[] value)
        Description copied from interface: SegmentedBytesStore
        Write a new value to the store with the provided key. The key should be a composite of the record key, and the timestamp information etc as described by the SegmentedBytesStore.KeySchema
        Specified by:
        put in interface SegmentedBytesStore
      • get

        public byte[] get​(org.apache.kafka.common.utils.Bytes key)
        Description copied from interface: SegmentedBytesStore
        Get the record from the store with the given key. The key should be a composite of the record key, and the timestamp information etc as described by the SegmentedBytesStore.KeySchema
        Specified by:
        get in interface SegmentedBytesStore
        Returns:
      • name

        public String name()
        Description copied from interface: StateStore
        The name of this store.
        Specified by:
        name in interface StateStore
        Returns:
        the storage name
      • flush

        public void flush()
        Description copied from interface: StateStore
        Flush any cached data
        Specified by:
        flush in interface StateStore
      • close

        public void close()
        Description copied from interface: StateStore
        Close the storage engine. Note that this function needs to be idempotent since it may be called several times on the same state store.

        Users only need to implement this function but should NEVER need to call this api explicitly as it will be called by the library automatically when necessary

        Specified by:
        close in interface StateStore
      • persistent

        public boolean persistent()
        Description copied from interface: StateStore
        Return if the storage is persistent or not.
        Specified by:
        persistent in interface StateStore
        Returns:
        true if the storage is persistent—false otherwise
      • isOpen

        public boolean isOpen()
        Description copied from interface: StateStore
        Is this store open for reading and writing
        Specified by:
        isOpen in interface StateStore
        Returns:
        true if the store is open