Class IgniteAdapter.Builder
- Enclosing interface:
- IgniteAdapter
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(org.apache.ignite3.client.IgniteClient ignite3Client) Creates a new instance of this builder. -
Method Summary
Modifier and TypeMethodDescriptionallowExtraFields(boolean allowExtraFields) The adaptedIgniteinstances support two distinct strategies for mapping Java Objects to Ignite 3 Tables.allowNonDefaultConstructors(boolean allowNonDefaultConstructors) This enables mapping Java classes which do not define a default constructor.org.apache.ignite.Ignitebuild()Creates a new adaptedIgniteinstance.computeDeploymentUnitsSelector(@Nullable Function<Class<?>, List<org.apache.ignite3.deployment.DeploymentUnit>> selector) Allows loading additional classes into the classpath of compute jobs usingDeploymentUnit.tableTypeRegistry(org.apache.ignite.migrationtools.tablemanagement.TableTypeRegistry tableTypeRegistry) Overrides the defaultTableTypeRegistryimplementation.
-
Constructor Details
-
Builder
public Builder(org.apache.ignite3.client.IgniteClient ignite3Client) Creates a new instance of this builder.- Parameters:
ignite3Client- An Ignite 3 client.
-
-
Method Details
-
tableTypeRegistry
public IgniteAdapter.Builder tableTypeRegistry(org.apache.ignite.migrationtools.tablemanagement.TableTypeRegistry tableTypeRegistry) Overrides the defaultTableTypeRegistryimplementation.The
TableTypeRegistryis an important component of the adapter since it provides mappings between table and their corresponding Java Classes. In Ignite 2, this information can be found in the cache's Query Entities. However, Ignite 2 does not force records to comply with one of the Query entities defined for the cache, therefore, this registry only provides hints as to what the mappings should be; it may not cover all record schemas in the cache.Currently, the default
TableTypeRegistryimplementation is backed by a persistent table (seePersistentTableTypeRegistryImpl).- Parameters:
tableTypeRegistry- The newTableTypeRegistryimplementation.- Returns:
- The same instance of the builder.
-
allowExtraFields
The adaptedIgniteinstances support two distinct strategies for mapping Java Objects to Ignite 3 Tables.With allowExtraField enabled, unsupported attributes in the mapped type, for instance, other nested Java Objects will be mapped to an additional column allowing them to be persisted and retrieved alongside the data. This mimics the default behaviour in Ignite 2 since Java Objects are fully serialized into cache rows irrespectively of the cache's indexed types and query entities.
When this feature is disabled, the mapped classes must completely match the Ignite 3 table schema.
Unfortunately, this feature may introduce a significant performance penalty for large objects. Therefore, it is disabled by default.
This feature is closely related to the PACK_EXTRA mode in the migrate cache cli. If, by any chance, you are working with caches migrated using this mode, you should enable this feature to have access to all the migrated data out-of-the-box.
- Parameters:
allowExtraFields- Enables or Disables this feature.- Returns:
- The same instance of the builder.
-
allowNonDefaultConstructors
This enables mapping Java classes which do not define a default constructor.This feature is not supported natively in Ignite 3 / Gridgain 9. As a result, we encourage you to implement default constructors in your data classes instead of relying on this feature since it relies on unsafe mechanisms and introduces a small performance penalty.
This feature is disabled by default.- Parameters:
allowNonDefaultConstructors- Enables or Disables this feature.- Returns:
- The same instance of the builder.
-
computeDeploymentUnitsSelector
public IgniteAdapter.Builder computeDeploymentUnitsSelector(@Nullable @Nullable Function<Class<?>, List<org.apache.ignite3.deployment.DeploymentUnit>> selector) Allows loading additional classes into the classpath of compute jobs usingDeploymentUnit. This function should supply a list of DeploymentUnits based on the Class of the compute job. The deployment units must be manually installed in the Gridgain 9 cluster before being used.- Parameters:
selector- Deployment Unit selector function.- Returns:
- The same instance of the builder.
-
build
public org.apache.ignite.Ignite build()Creates a new adaptedIgniteinstance.- Returns:
- The new instance.
-