Interface DataStore

All Known Subinterfaces:
ManagedDataStore
All Known Implementing Classes:
FileSystemDataStore, HttpDataStore, InMemoryDataStore, S3DataStore

public interface DataStore
A representation of a generic data store, for reading and writing data typically used by workers in the course of their computation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(String reference)
    Delete asset identified by reference
    retrieve(String reference)
    Provide a stream to get data by reference
    long
    size(String reference)
    Get the byte size of some data in the DataStore by reference
    store(byte[] data, String partialReference)
    Store data from a byte array.
    store(InputStream dataStream, String partialReference)
    Store data from a stream, which should be closed by the caller.
    store(Path dataPath, String partialReference)
    Store data from a local file.
  • Method Details

    • delete

      void delete(String reference) throws DataStoreException
      Delete asset identified by reference
      Parameters:
      reference - a complete reference to be interpreted by the DataStore implementation
      Throws:
      DataStoreException - if data store cannot service the request
    • retrieve

      InputStream retrieve(String reference) throws DataStoreException
      Provide a stream to get data by reference
      Parameters:
      reference - a complete reference to be interpreted by the DataStore implementation
      Returns:
      the raw data referred to as a stream, which should be closed by the caller
      Throws:
      DataStoreException - if the data store cannot service the request
    • size

      long size(String reference) throws DataStoreException
      Get the byte size of some data in the DataStore by reference
      Parameters:
      reference - a complete reference to be interpreted by the DataStore implementation
      Returns:
      the size in bytes of the data being referred to
      Throws:
      DataStoreException - if the data store cannot service the request
    • store

      String store(InputStream dataStream, String partialReference) throws DataStoreException
      Store data from a stream, which should be closed by the caller. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.
      Parameters:
      dataStream - the stream of data which will be read and put into the DataStore
      partialReference - the partial reference, which the data will be stored relative to
      Returns:
      absolute reference to the stored data, which can be used to retrieve
      Throws:
      DataStoreException - if the data store cannot service the request
    • store

      String store(byte[] data, String partialReference) throws DataStoreException
      Store data from a byte array. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.
      Parameters:
      data - the raw byte data to store
      partialReference - the partial reference, which the data will be stored relative to
      Returns:
      absolute reference to the stored data, which can be used to retrieve
      Throws:
      DataStoreException - if the data store cannot service the request
    • store

      String store(Path dataPath, String partialReference) throws DataStoreException
      Store data from a local file. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.
      Parameters:
      dataPath - path to a file on the local filesystem to store on the remote DataStore
      partialReference - the partial reference, which the data will be stored relative to
      Returns:
      absolute reference to the stored data, which can be used to retrieve
      Throws:
      DataStoreException - if the data store cannot service the request