Class SmartKeySource
- All Implemented Interfaces:
ChunkSource<Attributes.Values>,ChunkSource.WithPrev<Attributes.Values>,DefaultChunkSource<Attributes.Values>,DefaultChunkSource.WithPrev<Attributes.Values>,FillContextMaker,GetContextMaker,ColumnSource<com.fishlib.datastructures.util.SmartKey>,ColumnSourceGetDefaults.ForObject<com.fishlib.datastructures.util.SmartKey>,ElementSource<com.fishlib.datastructures.util.SmartKey>,MutableColumnSource<com.fishlib.datastructures.util.SmartKey>,MutableColumnSourceGetDefaults.ForObject<com.fishlib.datastructures.util.SmartKey>,Releasable,TupleExporter<com.fishlib.datastructures.util.SmartKey>,TupleSource<com.fishlib.datastructures.util.SmartKey>,Serializable
ColumnSource that produces key column values as SmartKeys from multiple ColumnSources.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
AbstractColumnSource.DefaultedImmutable<DATA_TYPE>, AbstractColumnSource.DefaultedMutable<DATA_TYPE>, AbstractColumnSource.IsSerializableNested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
ChunkSource.WithPrev<ATTR extends Attributes.Any>Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Attributes.Any>, DefaultChunkSource.WithPrev<ATTR extends Attributes.Any> -
Field Summary
Fields inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
componentType, typeFields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAYFields inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
ZERO_LENGTH_COLUMN_SOURCE_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionSmartKeySource(ColumnSource... columnSources) Construct a new tuple source backed by the supplied column sources. -
Method Summary
Modifier and TypeMethodDescriptionfinal com.fishlib.datastructures.util.SmartKeycreatePreviousTuple(long indexKey) Create a tuple for previous key column values at the supplied index key.final com.fishlib.datastructures.util.SmartKeycreateTuple(long indexKey) Create a tuple for key column values at the supplied index key.final com.fishlib.datastructures.util.SmartKeycreateTupleFromValues(Object... values) Create a tuple for the supplied (boxed) values.final ObjectexportElement(com.fishlib.datastructures.util.SmartKey smartKey, int elementIndex) Export a single element from the tuple, identified by its element index, to an Objectfinal <ELEMENT_TYPE>
voidexportElement(com.fishlib.datastructures.util.SmartKey smartKey, int elementIndex, WritableSource<ELEMENT_TYPE> writableSource, long destinationIndexKey) Export a single element from the tuple, identified by its element index, to the destination index key of the supplied writable source.final com.fishlib.datastructures.util.SmartKeyexportToExternalKey(com.fishlib.datastructures.util.SmartKey smartKey) Export this tuple's element list as a key suitable for theTableMaps resulting fromTable.byExternal(boolean, java.lang.String...).final voidfillChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> destination, OrderedKeys orderedKeys) Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.final voidfillPrevChunk(ChunkSource.FillContext context, WritableChunk<? super Attributes.Values> destination, OrderedKeys orderedKeys) Populates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.final com.fishlib.datastructures.util.SmartKeyget(long indexKey) Get the value from the source.final Chunk<Attributes.Values>getChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys) Returns a chunk of data corresponding to the keys from the givenOrderedKeys.final List<ColumnSource>Get theColumnSources backing this tuple source.final Class<com.fishlib.datastructures.util.SmartKey>final com.fishlib.datastructures.util.SmartKeygetPrev(long indexKey) Get the previous value at the index.final Chunk<Attributes.Values>getPrevChunk(ChunkSource.GetContext context, OrderedKeys orderedKeys) Returns a chunk of previous data corresponding to the keys from the givenOrderedKeys.final ChunkSource<Attributes.Values>final com.illumon.iris.db.v2.tuples.SmartKeySource.FillContextmakeFillContext(int chunkCapacity, SharedContext sharedContext) Allocate a newChunkSource.FillContextfor filling chunks from thisFillContextMaker, typically aChunkSource.final com.illumon.iris.db.v2.tuples.SmartKeySource.GetContextmakeGetContext(int chunkCapacity, SharedContext sharedContext) Allocate a newChunkSource.GetContextfor retrieving chunks from thisGetContextMaker, typically aChunkSource.final voidColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called.Methods inherited from class com.illumon.iris.db.v2.sources.AbstractColumnSource
allowsReinterpret, canUseGrouping, defaultFillChunk, doReinterpret, getComponentType, getGroupingBuilder, getGroupingProvider, getType, hasGrouping, hasGrouping, isSerializable, match, matchWithGrouping, reinterpret, setGroupingProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.ChunkSource
getChunkTypeMethods inherited from interface com.illumon.iris.db.v2.sources.ColumnSource
allowsReinterpret, cast, getComponentType, getGroupingBuilder, getGroupingProvider, getType, hasGrouping, hasGrouping, match, reinterpret, releaseCachedResources, setGroupingProviderMethods inherited from interface com.illumon.iris.db.v2.sources.ColumnSourceGetDefaults.ForObject
getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShortMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource
getChunk, getChunkByFillingMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunkByFillingMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.FillContextMaker
makeFillContextMethods inherited from interface com.illumon.iris.db.v2.sources.chunk.GetContextMaker
makeGetContextMethods inherited from interface com.illumon.iris.db.v2.sources.MutableColumnSource
isImmutableMethods inherited from interface com.illumon.iris.db.v2.sources.MutableColumnSourceGetDefaults.ForObject
getPrevBoolean, getPrevByte, getPrevChar, getPrevDouble, getPrevFloat, getPrevInt, getPrevLong, getPrevShortMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleExporter
exportElementReinterpretedMethods inherited from interface com.illumon.iris.db.v2.tuples.TupleSource
createTupleFromReinterpretedValues
-
Constructor Details
-
SmartKeySource
Construct a new tuple source backed by the supplied column sources. The column sources array should not be changed after this call.- Parameters:
columnSources- The column sources to produce tuples from
-
-
Method Details
-
startTrackingPrevValues
public final void startTrackingPrevValues()Description copied from interface:ColumnSourceColumnSource implementations that track previous values have the option to not actually start tracking previous values until this method is called. This is an option, not an obligation: some simple ColumnSource implementations (like TSingleValueSource for various T) always track previous values; other implementations (like PrevColumnSource) never do; some (like TArrayColumnSource) only start tracking once this method is called. An immutable column source can not have distinct prev values; therefore it is implemented as a no-op.- Specified by:
startTrackingPrevValuesin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>
-
get
public final com.fishlib.datastructures.util.SmartKey get(long indexKey) Description copied from interface:ElementSourceGet the value from the source. This may return boxed values for basic types.- Specified by:
getin interfaceElementSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
indexKey- the location in index space to get the value from.- Returns:
- the value at the index, potentially null.
-
getPrev
public final com.fishlib.datastructures.util.SmartKey getPrev(long indexKey) Description copied from interface:ElementSourceGet the previous value at the index. Previous values are used during anLTMupdatecycle to process changes in data. Duringnormaloperation previous values will be identical tocurrentvalues.- Specified by:
getPrevin interfaceElementSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
indexKey- the location in index space to get the value from.- Returns:
- the previous value at the index, or null.
-
getColumnSources
Description copied from interface:TupleSourceGet theColumnSources backing this tuple source.- Specified by:
getColumnSourcesin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
getColumnSourcesin interfaceTupleSource<com.fishlib.datastructures.util.SmartKey>- Returns:
- The column sources
-
createTuple
public final com.fishlib.datastructures.util.SmartKey createTuple(long indexKey) Description copied from interface:TupleSourceCreate a tuple for key column values at the supplied index key.- Specified by:
createTuplein interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
createTuplein interfaceTupleSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
indexKey- The index key- Returns:
- The resulting tuple
-
createPreviousTuple
public final com.fishlib.datastructures.util.SmartKey createPreviousTuple(long indexKey) Description copied from interface:TupleSourceCreate a tuple for previous key column values at the supplied index key.- Specified by:
createPreviousTuplein interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
createPreviousTuplein interfaceTupleSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
indexKey- The index key- Returns:
- The resulting tuple
-
createTupleFromValues
public final com.fishlib.datastructures.util.SmartKey createTupleFromValues(@NotNull Object... values) Description copied from interface:TupleSourceCreate a tuple for the supplied (boxed) values.- Specified by:
createTupleFromValuesin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
createTupleFromValuesin interfaceTupleSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
values- The values- Returns:
- The resulting tuple
-
exportElement
public final <ELEMENT_TYPE> void exportElement(@NotNull com.fishlib.datastructures.util.SmartKey smartKey, int elementIndex, @NotNull WritableSource<ELEMENT_TYPE> writableSource, long destinationIndexKey) Description copied from interface:TupleExporterExport a single element from the tuple, identified by its element index, to the destination index key of the supplied writable source.For the empty tuple, this is unsupported.
For singles, this will copy the sole element, possibly in boxed form.
For doubles and longer, this will copy the specified element without any unnecessary boxing.
- Specified by:
exportElementin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
exportElementin interfaceTupleExporter<com.fishlib.datastructures.util.SmartKey>- Type Parameters:
ELEMENT_TYPE- the type of the element to be exported- Parameters:
smartKey- The tuple to export an element fromelementIndex- The element index to exportwritableSource- The destinationdestinationIndexKey- The destination index key
-
exportElement
public final Object exportElement(@NotNull com.fishlib.datastructures.util.SmartKey smartKey, int elementIndex) Description copied from interface:TupleExporterExport a single element from the tuple, identified by its element index, to an ObjectFor the empty tuple, this is unsupported.
For singles, this will copy the sole element, possibly in boxed form.
For doubles and longer, this will copy the specified element without any unnecessary boxing.
- Specified by:
exportElementin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
exportElementin interfaceTupleExporter<com.fishlib.datastructures.util.SmartKey>- Parameters:
smartKey- The tuple to export an element fromelementIndex- The element index to export- Returns:
- a single value from the tuple
-
exportToExternalKey
public final com.fishlib.datastructures.util.SmartKey exportToExternalKey(@NotNull com.fishlib.datastructures.util.SmartKey smartKey) Description copied from interface:TupleExporterExport this tuple's element list as a key suitable for the
TableMaps resulting fromTable.byExternal(boolean, java.lang.String...).For the empty tuple this is a unsupported.
For singles, this is the (boxed) sole element itself.
For doubles and longer, this is a newly-allocated "
SmartKey".- Specified by:
exportToExternalKeyin interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
exportToExternalKeyin interfaceTupleExporter<com.fishlib.datastructures.util.SmartKey>- Parameters:
smartKey- The tuple to export all elements from- Returns:
- The new smart key
-
getNativeType
- Specified by:
getNativeTypein interfaceChunkSource<Attributes.Values>- Specified by:
getNativeTypein interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Overrides:
getNativeTypein classAbstractColumnSource<com.fishlib.datastructures.util.SmartKey>
-
getChunk
public final Chunk<Attributes.Values> getChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSourceReturns a chunk of data corresponding to the keys from the givenOrderedKeys.- Specified by:
getChunkin interfaceChunkSource<Attributes.Values>- Specified by:
getChunkin interfaceDefaultChunkSource<Attributes.Values>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data poolorderedKeys- AnOrderedKeysrepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys
-
getPrevChunk
public final Chunk<Attributes.Values> getPrevChunk(@NotNull ChunkSource.GetContext context, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSource.WithPrevReturns a chunk of previous data corresponding to the keys from the givenOrderedKeys.- Specified by:
getPrevChunkin interfaceChunkSource.WithPrev<Attributes.Values>- Specified by:
getPrevChunkin interfaceDefaultChunkSource.WithPrev<Attributes.Values>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk. In particular, the Context may be used to provide a Chunk data poolorderedKeys- AnOrderedKeysrepresenting the keys to be fetched- Returns:
- A chunk of data corresponding to the keys from the given
OrderedKeys.
-
fillChunk
public final void fillChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSourcePopulates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.- Specified by:
fillChunkin interfaceChunkSource<Attributes.Values>- Overrides:
fillChunkin classAbstractColumnSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according toorderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).orderedKeys- AnOrderedKeysrepresenting the keys to be fetched
-
fillPrevChunk
public final void fillPrevChunk(@NotNull ChunkSource.FillContext context, @NotNull WritableChunk<? super Attributes.Values> destination, @NotNull OrderedKeys orderedKeys) Description copied from interface:ChunkSource.WithPrevPopulates the given destination chunk with data corresponding to the keys from the givenOrderedKeys.- Specified by:
fillPrevChunkin interfaceChunkSource.WithPrev<Attributes.Values>- Overrides:
fillPrevChunkin classAbstractColumnSource<com.fishlib.datastructures.util.SmartKey>- Parameters:
context- A context containing all mutable/state related data used in retrieving the Chunk.destination- The chunk to be populated according toorderedKeys. No assumptions shall be made about the size of the chunk shall be made. The chunk will be populated from position [0,orderedKeys.size()).orderedKeys- AnOrderedKeysrepresenting the keys to be fetched
-
getPrevSource
- Specified by:
getPrevSourcein interfaceChunkSource.WithPrev<Attributes.Values>- Specified by:
getPrevSourcein interfaceColumnSource<com.fishlib.datastructures.util.SmartKey>- Specified by:
getPrevSourcein interfaceDefaultChunkSource.WithPrev<Attributes.Values>- Returns:
- a chunk source which accesses the previous values.
-