Interface Objects

  • All Superinterfaces:
    Namespaceable

    public interface Objects
    extends Namespaceable
    Objects expose functionalities to work with key/value pairs.
    • Method Detail

      • store

        void store​(String namespace,
                   String key,
                   byte[] bytes)
            throws IOException
        Stores bytes for the given key.
        Parameters:
        namespace - the namespace identifier
        key - the key
        bytes - the value in bytes
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • store

        default void store​(String namespace,
                           Map<String,​byte[]> batch)
                    throws IOException
        Stores batch of key/value pairs.
        Parameters:
        namespace - the namespace identifier
        batch - batch of key/value pairs
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • get

        byte[] get​(String namespace,
                   String key)
            throws IOException
        Returns bytes associated to the given key.
        Parameters:
        namespace - the namespace identifier
        key - the key
        Returns:
        bytes associated to the key in the given namespace; null if not found
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • get

        default Map<String,​byte[]> get​(String namespace,
                                             Collection<String> keys)
                                      throws IOException
        Returns batch of key/values for the list of entries.
        Parameters:
        namespace - the namespace identifier
        keys - batch of keys
        Returns:
        map of key/value pairs for the given list of keys in the namespace; value is set to null if not found
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • delete

        boolean delete​(String namespace,
                       String key)
                throws IOException
        Delete the object; return true if object was found and removed successfully, false otherwise.
        Parameters:
        namespace - the namespace identifier
        key - the key
        Returns:
        true if key is found and deleted, false otherwise
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • delete

        default void delete​(String namespace,
                            Collection<String> keys)
                     throws IOException
        Delete batch of objects.
        Parameters:
        namespace - the namespace identifier
        keys - batch of keys
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • keys

        default Collection<String> keys​(String namespace,
                                        int start,
                                        int count)
                                 throws IOException
        Returns paginated list of entries; the returned list is not ordered.
        Parameters:
        namespace - the namespace identifier
        start - start offset
        count - maximum number of entries to return; -1 for infinite
        Returns:
        paginated list of keys in the namespace
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • keys

        Collection<String> keys​(String namespace,
                                String prefix,
                                int start,
                                int count)
                         throws IOException
        Returns paginated list of entries; the returned list is not ordered.
        Parameters:
        namespace - the namespace identifier
        prefix - to narrow down the search results
        start - start offset
        count - maximum number of entries to return; -1 for infinite
        Returns:
        paginated list of keys in the namespace
        Throws:
        IOException - exception thrown from the underlying storage implementation
      • size

        int size​(String namespace)
          throws IOException
        Returns number of key/value pairs in the given namespace.
        Parameters:
        namespace - the namespace identifier
        Returns:
        number of objects in the namespace
        Throws:
        IOException - exception thrown from the underlying storage implementation