Interface ObjectStore

  • All Known Implementing Classes:
    DuraCloudObjectStore, LocalObjectStore, MountableObjectStore

    public interface ObjectStore
    An ObjectStore provides access to a managed store containing objects that possess a set of attributes. ObjectStores allow storage within named containers, here called groups.
    Author:
    richardrodgers
    • Method Detail

      • init

        void init()
           throws IOException
        Initializes the storage service for use.
        Throws:
        IOException - if I/O error
      • objectExists

        boolean objectExists​(String group,
                             String id)
                      throws IOException
        Returns whether an object with the passed id exists in the store.
        Parameters:
        group - Group
        id - ID
        Returns:
        true if a representation of the object named by ID exists
        Throws:
        IOException - if I/O error
      • objectAttribute

        String objectAttribute​(String group,
                               String id,
                               String attrName)
                        throws IOException
        Obtains attributes of the representation of the object with passed ID.
        Parameters:
        group - Group
        id - ID
        attrName - - name of the attribute
        Returns:
        value of the attribute if it exists, else null
        Throws:
        IOException - if I/O error
      • fetchObject

        long fetchObject​(String group,
                         String id,
                         File file)
                  throws IOException
        Fetches a copy of the object with passed ID, and places it in passed file.
        Parameters:
        group - Group
        id - ID
        file - File
        Returns:
        number of bytes the replica used
        Throws:
        IOException - if I/O error
      • transferObject

        long transferObject​(String group,
                            File file)
                     throws IOException
        Transfers a copy of this file to the object store
        Parameters:
        group - Group
        file - the file to transfer to store
        Returns:
        number of bytes transferred to store or 0 if transfer failed.
        Throws:
        IOException - if I/O error
      • removeObject

        long removeObject​(String group,
                          String id)
                   throws IOException
        Removes the passed object from the store.
        Parameters:
        group - Group
        id - the id of the object to remove
        Returns:
        number of bytes the object was using, or 0 if object did not exist.
        Throws:
        IOException - if I/O error
      • moveObject

        long moveObject​(String srcgroup,
                        String destGroup,
                        String id)
                 throws IOException
        Moves the passed object from one storage group to another.
        Parameters:
        srcgroup - source group
        destGroup - destination group
        id - the id of the object to move between groups
        Returns:
        number of bytes moved or 0 if move failed.
        Throws:
        IOException - if I/O error