public class PersistentDataStoreFactory extends Object implements DataStoreFactory
Use with caution, since this may leave large files in a cache directory. To mitigate this, a note about persistent files that were written is written to stderr on JVM shutdown.
An instance of this class is safe for use from concurrent threads.
It is also safe to use multiple PersistentDataStoreFactory instances
using the same cache directory
(since ColumnStorage
uses MoveFileByteStore
s to ensure
that cached columns only appear in the cache when they are fully populated).
However, multiple PersistentDataStoreFactory instances may end up
doing work to cache the same input data at the same time,
which is not maximally efficient.
Constructor and Description |
---|
PersistentDataStoreFactory()
Default constructor.
|
PersistentDataStoreFactory(DiskCache cache,
TupleRunner tupleRunner)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DataStore |
readDataStore(DataSpec[] dataSpecs,
DataStore store0)
Generates a DataStore capable of supplying the data for a given
list of DataSpec objects.
|
static File |
toCacheDir(File baseDir)
Returns a suitable cache directory for use with this class,
given a base directory.
|
public PersistentDataStoreFactory(DiskCache cache, TupleRunner tupleRunner)
cache
- persistent storage cache;
if null, a default instance will be usedtupleRunner
- tuple runner;
if null, a default instance will be usedpublic PersistentDataStoreFactory()
public DataStore readDataStore(DataSpec[] dataSpecs, DataStore store0) throws IOException
DataStoreFactory
prevStore
argument may optionally supply the
result of a previous invocation of this method.
The implementation may choose to make use of the internal state
of such an instance for efficiency, for instance by re-using data
that has already been read.
Since the bulk data is managed by the DataStore object,
care should be taken about what happens to the DataStore
objects supplied to and returned from this method.
In particular, code both invoking and implementing this method should
usually make sure not to keep a reference to the prevStore
argument.
This method may perform the actual reading, and therefore take time. It is not intended to be invoked on the event dispatch thread.
readDataStore
in interface DataStoreFactory
dataSpecs
- data specifications; some elements may be nullstore0
- previously obtained DataStore, or nullIOException
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.