Interface DataStore

All Known Implementing Classes:
FileSystemDataStore

public interface DataStore
Interface for storing data or objects to some persistent backend.

The data store organizes related data, called Blobs, in collections called Containers. A container is referenced by a Reference, and each blob is referenced by a name. A data store is itself an abstract representation of the underlying storage, as the content could be stored on a local file system, cloud storage, or a database.

In addition to the container associated with each reference, there also exists a top-level or "root" container that can store data applicable to the entire data store. This is useful, for example, to store the parameter samplings used to generate the data.

  • Method Details

    • getContainer

      Container getContainer(Reference reference)
      Returns the container for the given reference. A container is always returned, though this does not imply the underlying storage exists or has been provisioned.
      Parameters:
      reference - the data reference
      Returns:
      the container
    • streamContainers

      Stream<Container> streamContainers() throws DataStoreException
      Returns a stream of all containers, excluding the root container, in this data store. The caller must close the stream when finished.
      Returns:
      a stream of containers
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • listContainers

      default List<Container> listContainers() throws DataStoreException
      Returns a list of all containers, excluding the root container, in this data store.
      Returns:
      a list of containers
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • getURI

      URI getURI()
      Returns the URI for this data store, which can be used with DataStoreFactory.getDataStore(java.net.URI).
      Returns:
      the URI
    • getIntent

      Intent getIntent() throws DataStoreException
      Returns the application intent that specifies what operations are valid against a data store.
      Returns:
      the application intent
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • setIntent

      void setIntent(Intent intent) throws DataStoreException
      Sets the application intent that specifies what operations are valid against a data store.
      Parameters:
      intent - the application intent
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • exists

      boolean exists() throws DataStoreException
      Returns true if the underlying, physical data store exists.
      Returns:
      true if the data store exists; false otherwise
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • delete

      boolean delete() throws DataStoreException
      Deletes this data store if it exists, including all containers and blobs contained within.
      Returns:
      true if the data store was deleted; false otherwise
      Throws:
      DataStoreException - if an error occurred accessing the data store
    • getRootContainer

      default Container getRootContainer()
      Returns the root container for this data store. This container is useful for storing general information or data about the experiment or data store.
      Returns:
      the root container
    • getContainer

      default Container getContainer(Referenceable reference)
      Returns the container for the given Referenceable object.
      Parameters:
      reference - the data reference
      Returns:
      the container
      See Also:
    • toJSON

      default String toJSON()
      Returns the contents of this data store formatted as JSON.
      Returns:
      the JSON string
    • toJSON

      default String toJSON(URI baseURI)
      Returns the contents of this data store formatted as JSON.
      Parameters:
      baseURI - the base URI, which is used to produce URLs
      Returns:
      the JSON string
    • toJSON

      default String toJSON(URI baseURI, boolean full)
      Returns the contents of this data store formatted as JSON.
      Parameters:
      baseURI - the base URI, which is used to produce URLs
      full - if true, output the full data (can produce large output)
      Returns:
      the JSON string