Class AbstractSharedCachingDataStore

    • Constructor Detail

      • AbstractSharedCachingDataStore

        public AbstractSharedCachingDataStore()
    • Method Detail

      • getRecord

        public DataRecord getRecord​(DataIdentifier identifier)
                             throws DataStoreException
        Description copied from interface: DataStore
        Returns the identified data record. The given identifier should be the identifier of a previously saved data record. Since records are never removed, there should never be cases where the identified record is not found. Abnormal cases like that are treated as errors and handled by throwing an exception.
        Specified by:
        getRecord in interface DataStore
        Overrides:
        getRecord in class AbstractDataStore
        Parameters:
        identifier - data identifier
        Returns:
        identified data record
        Throws:
        DataStoreException - if the data store could not be accessed, or if the given identifier is invalid
      • getRecordIfStored

        @Nullable
        public @Nullable DataRecord getRecordIfStored​(DataIdentifier dataIdentifier)
                                               throws DataStoreException
        Description copied from interface: DataStore
        Check if a record for the given identifier exists, and return it if yes. If no record exists, this method returns null.
        Specified by:
        getRecordIfStored in interface DataStore
        Parameters:
        dataIdentifier - data identifier
        Returns:
        the record if found, and null if not
        Throws:
        DataStoreException - if the data store could not be accessed
      • addRecord

        public DataRecord addRecord​(java.io.InputStream inputStream)
                             throws DataStoreException
        Description copied from interface: DataStore
        Creates a new data record. The given binary stream is consumed and a binary record containing the consumed stream is created and returned. If the same stream already exists in another record, then that record is returned instead of creating a new one.

        The given stream is consumed and not closed by this method. It is the responsibility of the caller to close the stream. A typical call pattern would be:

             InputStream stream = ...;
             try {
                 record = store.addRecord(stream);
             } finally {
                 stream.close();
             }
         
        Specified by:
        addRecord in interface DataStore
        Parameters:
        inputStream - binary stream
        Returns:
        data record that contains the given stream
        Throws:
        DataStoreException - if the data store could not be accessed
      • exists

        public boolean exists​(DataIdentifier identifier)
        Look in the backend for a record matching the given identifier. Returns true if such a record exists.
        Parameters:
        identifier - - An identifier for the record.
        Returns:
        true if a record for the provided identifier can be found.
      • setPath

        public void setPath​(java.lang.String path)
        ------------------------- setters ----------------------------------------------
      • setCacheSize

        public void setCacheSize​(long cacheSize)
      • setStagingSplitPercentage

        public void setStagingSplitPercentage​(int stagingSplitPercentage)
      • setUploadThreads

        public void setUploadThreads​(int uploadThreads)
      • setStagingPurgeInterval

        public void setStagingPurgeInterval​(int stagingPurgeInterval)
      • setStagingRetryInterval

        public void setStagingRetryInterval​(int stagingRetryInterval)
      • setStatisticsProvider

        public void setStatisticsProvider​(StatisticsProvider statisticsProvider)
      • addMetadataRecord

        public void addMetadataRecord​(java.io.InputStream stream,
                                      java.lang.String name)
                               throws DataStoreException
        ------------------------ SharedDataStore methods -----------------------------------------
        Specified by:
        addMetadataRecord in interface SharedDataStore
        Parameters:
        stream - the stream
        name - the name of the root record
        Throws:
        DataStoreException - the data store exception
      • getMetadataRecord

        public DataRecord getMetadataRecord​(java.lang.String name)
        Description copied from interface: SharedDataStore
        Retrieves the metadata record with the given name
        Specified by:
        getMetadataRecord in interface SharedDataStore
        Parameters:
        name - the name of the record
        Returns:
      • metadataRecordExists

        public boolean metadataRecordExists​(java.lang.String name)
        Description copied from interface: SharedDataStore
        Checks if the metadata record with the name exists
        Specified by:
        metadataRecordExists in interface SharedDataStore
        Returns:
      • deleteMetadataRecord

        public boolean deleteMetadataRecord​(java.lang.String name)
        Description copied from interface: SharedDataStore
        Deletes the root record represented by the given parameters.
        Specified by:
        deleteMetadataRecord in interface SharedDataStore
        Parameters:
        name - the name of the root record
        Returns:
        success/failure
      • deleteAllMetadataRecords

        public void deleteAllMetadataRecords​(java.lang.String prefix)
        Description copied from interface: SharedDataStore
        Deletes all records matching the given prefix.
        Specified by:
        deleteAllMetadataRecords in interface SharedDataStore
        Parameters:
        prefix - metadata type identifier
      • clearInUse

        public void clearInUse()
        ------------------------ unimplemented methods -------------------------------------------
        Specified by:
        clearInUse in interface DataStore
      • updateModifiedDateOnAccess

        public void updateModifiedDateOnAccess​(long l)
        Description copied from interface: DataStore
        From now on, update the modified date of an object even when accessing it. Usually, the modified date is only updated when creating a new object, or when a new link is added to an existing object. When this setting is enabled, even getLength() will update the modified date.
        Specified by:
        updateModifiedDateOnAccess in interface DataStore
        Parameters:
        l - - update the modified date to the current time if it is older than this value
      • deleteAllOlderThan

        public int deleteAllOlderThan​(long l)
                               throws DataStoreException
        Description copied from interface: DataStore
        Delete objects that have a modified date older than the specified date.
        Specified by:
        deleteAllOlderThan in interface DataStore
        Parameters:
        l - the minimum time
        Returns:
        the number of data records deleted
        Throws:
        DataStoreException