Interface SharedBackend

    • Method Detail

      • read

        java.io.InputStream read​(DataIdentifier identifier)
                          throws DataStoreException
        Return inputstream of record identified by identifier.
        Parameters:
        identifier - identifier of record.
        Returns:
        inputstream of the record.
        Throws:
        DataStoreException - if record not found or any error.
      • write

        void write​(DataIdentifier identifier,
                   java.io.File file)
            throws DataStoreException
        Stores file to backend with identifier used as key. If key pre-exists, it updates the timestamp of the key.
        Parameters:
        identifier - key of the file
        file - file that would be stored in backend.
        Throws:
        DataStoreException - for any error.
      • exists

        boolean exists​(DataIdentifier identifier)
                throws DataStoreException
        This method check the existence of record in backend.
        Parameters:
        identifier - identifier to be checked.
        Returns:
        true if records exists else false.
        Throws:
        DataStoreException
      • addMetadataRecord

        void addMetadataRecord​(java.io.InputStream input,
                               java.lang.String name)
                        throws DataStoreException
        Adds a metadata record with the specified name
        Parameters:
        input - the record input stream
        name - the name
        Throws:
        DataStoreException
      • addMetadataRecord

        void addMetadataRecord​(java.io.File input,
                               java.lang.String name)
                        throws DataStoreException
        Adds a metadata record with the specified name
        Parameters:
        input - the record file
        name - the name
        Throws:
        DataStoreException
      • getMetadataRecord

        DataRecord getMetadataRecord​(java.lang.String name)
        Gets the metadata of the specified name.
        Parameters:
        name - the name of the record
        Returns:
        the metadata DataRecord
      • getAllMetadataRecords

        java.util.List<DataRecord> getAllMetadataRecords​(java.lang.String prefix)
        Gets all the metadata with a specified prefix.
        Parameters:
        prefix - the prefix of the records to retrieve
        Returns:
        list of all the metadata DataRecords
      • deleteMetadataRecord

        boolean deleteMetadataRecord​(java.lang.String name)
        Deletes the metadata record with the specified name
        Parameters:
        name - the name of the record
        Returns:
        boolean to indicate success of deletion
      • deleteAllMetadataRecords

        void deleteAllMetadataRecords​(java.lang.String prefix)
        Deletes all the metadata records with the specified prefix.
        Parameters:
        prefix - the prefix of the record
      • metadataRecordExists

        boolean metadataRecordExists​(java.lang.String name)
        Checks if the metadata record with the specified name exists.
        Parameters:
        name - the name of the record
        Returns:
        whether record exists