Class DriverFileStore

java.lang.Object
com.complexible.stardog.virtual.api.DriverFileStore

public class DriverFileStore extends Object
Materializes the content supplied through the driver.file. data source options into files on the local filesystem, so that a driver which takes a path can be given one.

The content itself lives in the data source definition, which is replicated to every node and re-read whenever a data source is loaded, so the files here are derived state: each node writes its own copy, and the directory is cleared on startup rather than relied on to persist. That is what lets a data source configured this way work on a node that has never seen the files.

A data source's files are written into a directory named for the data source and a hash of the content, so updating a data source materializes its new content alongside the old rather than over it, and a version still in use by an open connection pool stays intact.

The content is secret, certificates and keystores among it, and nothing here restricts the permissions it is written with. It is protected the way everything else Stardog writes is: by the permissions on Stardog's home directory, which is the only place these files live.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Directory, relative to Stardog home, holding the materialized content.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes everything this store has materialized, along with the directory holding it.
    void
    remove(String dataSourceName, Properties closedOptions, Properties retainedOptions)
    Removes the files materialized for a data source that is gone, either because it was removed or because it was replaced.
    resolve(String dataSourceName, Properties options)
    Returns the data source options to configure the driver with: the supplied options with the driver.file. options replaced by the ext. options naming the files they were materialized into.
    The directory the content is materialized into.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HOME_SUBDIRECTORY

      public static final String HOME_SUBDIRECTORY
      Directory, relative to Stardog home, holding the materialized content. Owned entirely by this class: its contents are removed on startup.
      See Also:
  • Constructor Details

    • DriverFileStore

      public DriverFileStore(Path root)
  • Method Details

    • root

      public Path root()
      The directory the content is materialized into.
    • destroy

      public void destroy()
      Removes everything this store has materialized, along with the directory holding it. For a store whose lifetime is shorter than the process that created it.
    • resolve

      public Properties resolve(String dataSourceName, Properties options)
      Returns the data source options to configure the driver with: the supplied options with the driver.file. options replaced by the ext. options naming the files they were materialized into. Returns the supplied options unchanged when there are no driver.file. options.

      The result is a copy. The caller's options are what gets persisted to the registry, and must keep the content and stay free of the paths, which are local to this node.

      Parameters:
      dataSourceName - the data source the options belong to, used to name the directory
      options - the data source options as supplied by the client
    • remove

      public void remove(String dataSourceName, Properties closedOptions, @Nullable Properties retainedOptions)
      Removes the files materialized for a data source that is gone, either because it was removed or because it was replaced.

      A data source is replaced by building the replacement and closing the old one afterwards, so by the time this is called the replacement's content has already been materialized. When an update leaves the driver files alone, that content is the very same directory, which is what retainedOptions is for.

      Parameters:
      dataSourceName - the data source the options belong to, as it was passed to resolve(java.lang.String, java.util.Properties)
      closedOptions - the options of the data source that is gone, as they were passed to resolve(java.lang.String, java.util.Properties)
      retainedOptions - the options of the data source that replaced it, or null if it was removed