Class MvStoreDataset
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.pipeline.dataset.Dataset
com.northconcepts.datapipeline.foundations.pipeline.dataset.MvStoreDataset
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,Closeable,Serializable,AutoCloseable,Iterable<Record>
Caches the dataset's records on disk using MVStore.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.foundations.pipeline.dataset.Dataset
Dataset.ColumnsDataReader -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMvStoreDataset(File databaseFile) Opens the dataset saved in the given MVStore file, with its records and column stats already loaded.protectedMvStoreDataset(File databaseFile, AbstractPipeline pipeline) Creates a dataset that, when loaded, stores the pipeline's records in the given MVStore file. -
Method Summary
Modifier and TypeMethodDescriptionprotected ColumnAdds the field to the stats of its column, creating the column if needed; runs on a column stats worker thread.protected voidCalled at the end of the data loading process after all the records and column stats have been loaded.protected voidCalled at the start of the data loading process, but before any records or column stats have been loaded.voidclose()static MvStoreDatasetcreateDataset(File databaseFile, AbstractPipeline pipeline) Creates a persistent dataset on disk in the specifieddatabaseFile.protected DataWriterWrites records to this dataset's cache after clearing it.static MvStoreDatasetcreateTempDataset(AbstractPipeline pipeline) Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits.static MvStoreDatasetcreateTempDataset(File databaseFolder, AbstractPipeline pipeline) Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits.getColumn(int index) Returns the column with the given name or null if there is none.longprotected ColumngetOrCreateColumn(String name, int index) Returns the named column, creating it with the given 0-based field index if needed; called while collecting column stats.getRecord(long index) Returns the loaded record at the given 0-based index.longReturns the number of records loaded into this dataset so far.booleanIndicates if the MVStore file is deleted when this dataset is closed (defaults to false).load(Integer maxRecords, JobCallback<DataReader, DataWriter> callback) Starts the asynchronous loading of records from the pipeline into this dataset.static MvStoreDatasetopenDataset(File databaseFile) Loads an existing dataset from the specifieddatabaseFile.setDeleteDatabaseFileOnClose(boolean deleteDatabaseFileOnClose) Indicates if the MVStore file is deleted when this dataset is closed (defaults to false).setPipeline(AbstractPipeline pipeline) Methods inherited from class com.northconcepts.datapipeline.foundations.pipeline.dataset.Dataset
afterColumnStatsLoaded, afterRecordsLoaded, cancelLoad, createColumnsDataReader, createDataReader, createDataReader, finalize, forEach, fromRecord, getColumnStatsException, getColumnStatsReaderThreads, getDataLoadException, getJob, getJobExecutor, getMaxColumnStatsRecords, getMaxColumnsToAnalyze, getMaxRecordsToLoad, getPipeline, getRecordList, isCollectUniqueValues, isColumnStatsLoaded, isDataLoaded, isDataLoading, isDetectBigNumberValues, isDetectBooleanValues, isDetectNumericValues, isDetectTemporalValues, isDetectUuidValues, isInferStringTypes, isRecordsLoaded, iterator, load, load, setCollectUniqueValues, setColumnStatsLoaded, setColumnStatsReaderThreads, setDetectBigNumberValues, setDetectBooleanValues, setDetectNumericValues, setDetectTemporalValues, setDetectUuidValues, setInferStringTypes, setJobExecutor, setMaxColumnStatsRecords, setMaxColumnsToAnalyze, setRecordsLoaded, stream, toRecord, updateColumns, waitForColumnStatsToLoad, waitForColumnStatsToLoad, waitForRecordsToLoad, waitForRecordsToLoad, waitUntilJobFinishedMethods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
addExceptionProperties, assertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionPropertiesMethods inherited from interface java.lang.Iterable
spliteratorMethods inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
fromJson, fromJson, toJson, toJson, toJsonMethods inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
fromXml, fromXml, fromXmlElement, toXml, toXml, toXml, toXml, toXml, toXmlElement
-
Constructor Details
-
MvStoreDataset
Creates a dataset that, when loaded, stores the pipeline's records in the given MVStore file. -
MvStoreDataset
Opens the dataset saved in the given MVStore file, with its records and column stats already loaded.
-
-
Method Details
-
createTempDataset
Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits. The temporary file will be created in the default temporary-file directory, using the prefix "dataset-" and suffix ".mvstore" to generate its name.- Parameters:
pipeline- the source of the dataset's data
-
createTempDataset
Creates a temporary dataset on disk that will be deleted when the dataset is closed or when the JVM exits. The temporary file will be created in the specified directory (or the default temporary-file directory ifnull), using the prefix "dataset-" and suffix ".mvstore" to generate its name.- Parameters:
databaseFolder- the directory to store the temporary file ornullto use the default temporary-file directory.pipeline- the source of the dataset's data
-
createDataset
Creates a persistent dataset on disk in the specifieddatabaseFile. The file will remain on disk even after the dataset is closed and the JVM exits.- Parameters:
databaseFile- the file to store the dataset's contents.pipeline- the source of the dataset's data
-
openDataset
Loads an existing dataset from the specifieddatabaseFile.- Parameters:
databaseFile- the existing file to containing the dataset's contents to load.
-
setPipeline
- Overrides:
setPipelinein classDataset
-
getDatabaseFile
-
isDeleteDatabaseFileOnClose
public boolean isDeleteDatabaseFileOnClose()Indicates if the MVStore file is deleted when this dataset is closed (defaults to false). -
setDeleteDatabaseFileOnClose
Indicates if the MVStore file is deleted when this dataset is closed (defaults to false). -
close
public void close() -
getRecordCount
public long getRecordCount()Description copied from class:DatasetReturns the number of records loaded into this dataset so far.- Specified by:
getRecordCountin classDataset
-
getRecord
Description copied from class:DatasetReturns the loaded record at the given 0-based index. -
getColumnCount
public long getColumnCount()- Specified by:
getColumnCountin classDataset
-
getColumnNames
- Specified by:
getColumnNamesin classDataset
-
getColumn
-
getColumn
Description copied from class:DatasetReturns the column with the given name or null if there is none. -
getOrCreateColumn
Description copied from class:DatasetReturns the named column, creating it with the given 0-based field index if needed; called while collecting column stats.- Specified by:
getOrCreateColumnin classDataset
-
getColumns
- Specified by:
getColumnsin classDataset
-
addField
Description copied from class:DatasetAdds the field to the stats of its column, creating the column if needed; runs on a column stats worker thread. -
beforeLoad
protected void beforeLoad()Description copied from class:DatasetCalled at the start of the data loading process, but before any records or column stats have been loaded.- Specified by:
beforeLoadin classDataset
-
afterLoad
protected void afterLoad()Description copied from class:DatasetCalled at the end of the data loading process after all the records and column stats have been loaded. -
createDataWriter
Description copied from class:DatasetWrites records to this dataset's cache after clearing it.- Specified by:
createDataWriterin classDataset
-
load
Description copied from class:DatasetStarts the asynchronous loading of records from the pipeline into this dataset. This method returns immediately and does not wait for loading to complete. SeeDataset.waitForRecordsToLoad()andDataset.waitForRecordsToLoad(long, long).
-