Class StoreDescription
java.lang.Object
com.activeviam.database.datastore.api.description.impl.StoreDescription
- All Implemented Interfaces:
IDataTable
,IStoreDescription
Default immutable implementation of
IStoreDescription
.- Author:
- ActiveViam
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface com.activeviam.database.datastore.api.description.IStoreDescription
BATCH_SIZE_PROPERTY
-
Constructor Summary
ConstructorsConstructorDescriptionStoreDescription
(@NonNull String name, List<String> keyFieldNames, List<? extends IFieldDescription> fields) Constructor which makes the collections immutable.StoreDescription
(@NonNull String name, List<String> keyFieldNames, List<? extends IFieldDescription> fields, IPartitioningDescription partitioning, Collection<IOptimizationDescription> optimizations, boolean updateOnlyIfDifferent, int chunkSize, IDuplicateKeyHandler duplicateKeyHandler, IStoreDescriptionBuilder.IRemoveUnknownKeyListener removeUnknownKeyBehavior, Properties properties, INumaSelectorDescription numaNodeSelector, boolean shouldCompressIndexes) Deprecated, for removal: This API element is subject to removal in a future version.Use the builder instead -
Method Summary
Modifier and TypeMethodDescriptionstatic IStoreDescriptionBuilder
builder()
Retrieves a builder to construct this class.boolean
int
Gets the chunk size required for this store.Returns how to handle adding two records with the same key fields.List
<? extends IFieldDescription> Gets the fields of this table, ordered by field index.Gets the key field names of this table.getName()
Gets the name of the table.Gets the numa selector.Returns theoptimizations
to use on fields of this schema.Gets the description of the partitioning on this store (null if there is no partitioning in place).
A partitioning expression contains the partition key (one or several fields that belongs to a store) and a partitioning policy (will there be one partition per distinct value of the partition key, or some bucketing based on the hash of the partition key)
The schema can be partitioned by several such expressions, one per store at most.Returns some additionalproperties
.Gets the policy handling a remove operation on an unknown key.int
hashCode()
boolean
Specifies to store the indexes of this store in a compressed format, in order to reduce the memory usage.Creates a non-fluentIStoreDescription
builder.Creates a non-fluentIStoreDescription
builder initialized with the given description.toString()
boolean
States whether a record should be updated when it contains exactly the same content as the previously existing record.Methods inherited from interface com.activeviam.database.api.schema.IDataTable
getFieldIndex, getFieldNames, hasField
Methods inherited from interface com.activeviam.database.datastore.api.description.IStoreDescription
getField, getKeyFields
-
Constructor Details
-
StoreDescription
public StoreDescription(@NonNull @NonNull String name, List<String> keyFieldNames, List<? extends IFieldDescription> fields) Constructor which makes the collections immutable.- Parameters:
name
- the name of the storekeyFieldNames
- the key fieldsfields
- the field descriptions
-
StoreDescription
@DeprecatedApi(forRemoval="6.2.0", rationale="Use the builder instead") @Deprecated(since="6.1.5", forRemoval=true) public StoreDescription(@NonNull @NonNull String name, List<String> keyFieldNames, List<? extends IFieldDescription> fields, @Nullable IPartitioningDescription partitioning, Collection<IOptimizationDescription> optimizations, boolean updateOnlyIfDifferent, int chunkSize, IDuplicateKeyHandler duplicateKeyHandler, IStoreDescriptionBuilder.IRemoveUnknownKeyListener removeUnknownKeyBehavior, Properties properties, @Nullable INumaSelectorDescription numaNodeSelector, boolean shouldCompressIndexes) Deprecated, for removal: This API element is subject to removal in a future version.Use the builder insteadConstructor which makes the collections immutable.- Parameters:
name
- seegetName()
keyFieldNames
- seegetKeyFieldNames()
fields
- seegetFields()
partitioning
- seegetPartitioning()
optimizations
- seegetOptimizationDescriptions()
updateOnlyIfDifferent
- seeupdateOnlyIfDifferent()
chunkSize
- seegetChunkSize()
duplicateKeyHandler
- seegetDuplicateKeyHandler()
removeUnknownKeyBehavior
- seegetRemoveUnknownKeyBehavior()
properties
- seegetProperties()
numaNodeSelector
- seegetNumaSelector()
shouldCompressIndexes
- seeshouldCompressIndexes()
-
-
Method Details
-
builder
Retrieves a builder to construct this class. -
simpleBuilder
Creates a non-fluentIStoreDescription
builder.- Returns:
- the builder
- See Also:
-
simpleBuilder
Creates a non-fluentIStoreDescription
builder initialized with the given description.This method is for case when one need to change a few attributes of an existing
IStoreDescription
.- Parameters:
desc
- the description used to initialize the builder- Returns:
- the builder
-
updateOnlyIfDifferent
public boolean updateOnlyIfDifferent()Description copied from interface:IStoreDescription
States whether a record should be updated when it contains exactly the same content as the previously existing record.- Specified by:
updateOnlyIfDifferent
in interfaceIStoreDescription
-
shouldCompressIndexes
public boolean shouldCompressIndexes()Description copied from interface:IStoreDescription
Specifies to store the indexes of this store in a compressed format, in order to reduce the memory usage.It is false by default, as it entails a performance cost (additional computation is needed to "decompress", and reading a key may require additional memory accesses).
Therefore, you should set this option to true only if you encounter memory issues.
- Specified by:
shouldCompressIndexes
in interfaceIStoreDescription
- Returns:
- true if we should attempt to reduce memory usage at the cost of performance, false otherwise
-
equals
-
hashCode
public int hashCode() -
toString
-
getName
Description copied from interface:IDataTable
Gets the name of the table.- Specified by:
getName
in interfaceIDataTable
-
getKeyFieldNames
Description copied from interface:IDataTable
Gets the key field names of this table.- Specified by:
getKeyFieldNames
in interfaceIDataTable
-
getFields
Description copied from interface:IDataTable
Gets the fields of this table, ordered by field index.The index of a field is its 0-based position within the table.
- Specified by:
getFields
in interfaceIDataTable
- Specified by:
getFields
in interfaceIStoreDescription
-
getPartitioning
Description copied from interface:IStoreDescription
Gets the description of the partitioning on this store (null if there is no partitioning in place).
A partitioning expression contains the partition key (one or several fields that belongs to a store) and a partitioning policy (will there be one partition per distinct value of the partition key, or some bucketing based on the hash of the partition key)
The schema can be partitioned by several such expressions, one per store at most.Expression examples:
- value(product) | value(currency)
- modulo8(tradeId)
- Specified by:
getPartitioning
in interfaceIStoreDescription
-
getChunkSize
public int getChunkSize()Description copied from interface:IStoreDescription
Gets the chunk size required for this store.- Specified by:
getChunkSize
in interfaceIStoreDescription
- Returns:
- the wanted chunk size, or -1 if none defined
- See Also:
-
getOptimizationDescriptions
Description copied from interface:IStoreDescription
Returns theoptimizations
to use on fields of this schema.- Specified by:
getOptimizationDescriptions
in interfaceIStoreDescription
-
getDuplicateKeyHandler
Description copied from interface:IStoreDescription
Returns how to handle adding two records with the same key fields.- Specified by:
getDuplicateKeyHandler
in interfaceIStoreDescription
-
getRemoveUnknownKeyBehavior
Description copied from interface:IStoreDescription
Gets the policy handling a remove operation on an unknown key.- Specified by:
getRemoveUnknownKeyBehavior
in interfaceIStoreDescription
-
getProperties
Description copied from interface:IStoreDescription
Returns some additionalproperties
.- Specified by:
getProperties
in interfaceIStoreDescription
-
getNumaSelector
Description copied from interface:IStoreDescription
Gets the numa selector.- Specified by:
getNumaSelector
in interfaceIStoreDescription
-