Package com.illumon.iris.db.v2.snapshot
Class SnapshotUtils
java.lang.Object
com.illumon.iris.db.v2.snapshot.SnapshotUtils
public class SnapshotUtils extends Object
-
Constructor Summary
Constructors Constructor Description SnapshotUtils()
-
Method Summary
Modifier and Type Method Description static void
copyDataColumns(Map<String,? extends ChunkSource.WithPrev> srcColumns, Index srcIndex, Map<String,? extends WritableSource> destColumns, Index destIndex, boolean usePrev)
For each name in srcColumns, copy all the data at srcColumns.get(name) (with a range of rows defined by srcIndex) to a column indicated by destColumns.get(name) (with a range of rows defined by destIndex).static void
copyStampColumns(Map<String,? extends ColumnSource> stampColumns, long stampKey, Map<String,? extends WritableSource> destColumns, long destKey)
Like the above, but with a singleton destination.static void
copyStampColumns(Map<String,? extends ColumnSource> stampColumns, long stampKey, Map<String,? extends WritableSource> destColumns, Index destIndex)
For each name in stampColumns: - identify a stamp source (namely 'stampColumns.get(name)') - a row in that stamp source (namely 'stampKey') - a stamp dest (namely the column identified by 'destColumns.get(name)') - a bunch of destination rows (namely all the rows defined in 'destIndex') Then "spray" that single source value over those destination values.static <T> Map<String,T>
createColumnSourceMap(Map<String,? extends ColumnSource> columns, BiFunction<Class,Class,T> factory)
Creates a new columnSourceMap based on 'columns'.
-
Constructor Details
-
SnapshotUtils
public SnapshotUtils()
-
-
Method Details
-
createColumnSourceMap
public static <T> Map<String,T> createColumnSourceMap(Map<String,? extends ColumnSource> columns, BiFunction<Class,Class,T> factory)Creates a new columnSourceMap based on 'columns'. -
copyStampColumns
public static void copyStampColumns(@NotNull Map<String,? extends ColumnSource> stampColumns, long stampKey, @NotNull Map<String,? extends WritableSource> destColumns, @NotNull Index destIndex)For each name in stampColumns: - identify a stamp source (namely 'stampColumns.get(name)') - a row in that stamp source (namely 'stampKey') - a stamp dest (namely the column identified by 'destColumns.get(name)') - a bunch of destination rows (namely all the rows defined in 'destIndex') Then "spray" that single source value over those destination values.- Parameters:
stampColumns
- The stamp columns that serve as the source datastampKey
- The source keydestColumns
- The destination columns we are "spraying" todestIndex
- The keys in destColumns we want to write to
-
copyStampColumns
public static void copyStampColumns(@NotNull Map<String,? extends ColumnSource> stampColumns, long stampKey, @NotNull Map<String,? extends WritableSource> destColumns, long destKey)Like the above, but with a singleton destination. For each name in stampColumns: - identify a stamp source (namely 'stampColumns.get(name)') - a row in that stamp source (namely 'stampKey') - a stamp dest (namely the column identified by 'destColumns.get(name)') - a row in the destination (namely 'destKey') Then copy the source value to the destination value.- Parameters:
stampColumns
- The stamp columns that serve as the source datastampKey
- The source keydestColumns
- The destination columns we are writing to todestKey
- The key in destColumns we want to write to
-
copyDataColumns
public static void copyDataColumns(@NotNull Map<String,? extends ChunkSource.WithPrev> srcColumns, @NotNull Index srcIndex, @NotNull Map<String,? extends WritableSource> destColumns, @NotNull Index destIndex, boolean usePrev)For each name in srcColumns, copy all the data at srcColumns.get(name) (with a range of rows defined by srcIndex) to a column indicated by destColumns.get(name) (with a range of rows defined by destIndex).- Parameters:
srcColumns
- The stamp columns that serve as the source datasrcIndex
- The keys in the srcColumns we are reading fromdestColumns
- The destination columns we are writing todestIndex
- The keys in destColumns we want to write to
-