Skip to content

CLIENT-4143 Restructure to support the new Java client#204

Draft
agrgr wants to merge 8 commits intomainfrom
CLIENT-4143-to-multi-module
Draft

CLIENT-4143 Restructure to support the new Java client#204
agrgr wants to merge 8 commits intomainfrom
CLIENT-4143-to-multi-module

Conversation

@agrgr
Copy link
Collaborator

@agrgr agrgr commented Mar 10, 2026

No description provided.

agrgr and others added 5 commits February 20, 2026 18:38
…ceMapper, ObjectEmbedMapper to use IObjectMapper/IRecordConverter

- Replace IBaseAeroMapper with IObjectMapper in ClassCache, ClassCacheEntry,
  MappingConverter, ObjectReferenceMapper, ObjectEmbedMapper
- Remove policy storage (defaultPolicies, childrenPolicies, specificPolicies,
  determinePolicy, setDefaultPolicies, setReactiveDefaultPolicies) from ClassCache;
  moved to new PolicyCache singleton in legacy
- Remove policy constructor params and getter methods (getReadPolicy, getWritePolicy,
  getBatchPolicy, getQueryPolicy, getScanPolicy) from ClassCacheEntry
- Remove getBins, constructAndHydrate(Key,Record), hydrateFromRecord from ClassCacheEntry;
  add getKeyFieldName(), isKeyFieldStoredAsBin(), setGenerationValue() helpers
- Replace IAerospikeClient with RecordLoader in MappingConverter constructor;
  new AerospikeRecordLoader implements RecordLoader via IAerospikeClient
- Remove Key/Record convertToObject overloads from MappingConverter; keep
  map/list-based overloads and add resolveDependencies=false variant
- ObjectReferenceMapper uses mapper.getRecordLoader() for record fetches
- Add IRecordConverter core interface; IObjectMapper returns IRecordConverter
  (MappingConverter implements IRecordConverter)
- IBaseAeroMapper extends IObjectMapper with covariant MappingConverter return
- AeroMapper and ReactiveAeroMapper implement getRecordLoader(); use PolicyCache
  for policy lookups instead of ClassCacheEntry policy getters
- Also update TypeUtils, ListMapper, MapMapper, PropertyDefinition, MapperUtils
  and virtuallist classes to use IObjectMapper; fix BaseVirtualList write policy

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@agrgr agrgr requested a review from tim-aero March 10, 2026 16:03
@agrgr agrgr added the enhancement New feature or request label Mar 10, 2026
@github-advanced-security
Copy link

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@agrgr
Copy link
Collaborator Author

agrgr commented Mar 10, 2026

The build is stable and only missing fluent client dependency.

this.classConfig.setSendKey(sendKey);
return this;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the shortName being removed? We still need this to put a smaller type in a list representation don't we?

Comment on lines +162 to +164
* If an object refers to other objects via @AerospikeReference, reading the object will populate the ids.
* This method batch-loads those referenced objects and wires them back into the parent.
* @param parentEntity the ClassCacheEntry of the parent entity (may be null).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment misses that there are configuration options which can stop these objects being loaded (eg lazy = true) and that it will recursively descend potentially through multiple batch calls.

Comment on lines +207 to +213
if (bins != null && !entry.isKeyFieldStoredAsBin()) {
String keyFieldName = entry.getKeyFieldName();
if (keyFieldName != null && rk.keyValue != null) {
bins = new HashMap<>(bins);
bins.put(keyFieldName, rk.keyValue);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if they use a property as the key, rather than a field?

} else {
batchPolicyClone.maxConcurrentThreads = batchPolicy.maxConcurrentThreads;
}
Record[] records = aerospikeClient.get(batchPolicyClone, keys);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that we might lose information if we pass a Map here. For example, what if we introduce versioned records based on the generation of the record? (Ie map the generation to an integer field marked with @Version for example)

}
}

private Object resolveFromDigest(ClassCacheEntry<?> entry, byte[] digest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't resolveByDigest be more consistent with resolveByKey?


List<Map<String, Object>> results = new ArrayList<>(Collections.nCopies(keys.size(), null));

try (RecordStream rs = session.query(fluentKeys).executeSync()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should juse be execute() not executeSync()

public List<E> getByRankRange(WritePolicy writePolicy, int rank, int count, ReturnType returnResultsOfType) {
if (writePolicy == null) {
writePolicy = new WritePolicy(owningEntry.getWritePolicy());
writePolicy = getWritePolicy(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mapper can specify policies on a per-class, or inheritance tree basis. What you have here only uses the default policy. These don't seem to be the same to me. Applies to many methods in this section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the PolicyCache take care of this?

Comment on lines +251 to +252
T result = entry.constructAndHydrate(map);
entry.setGenerationValue(result, record.generation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is confusing as to why it's doing a 2-step process. It could do with a clarifying comment.

try {
mClient.scanAll(policy, namespace, setName, (key, record) -> {
T object = this.getMappingConverter().convertToObject(clazz, key, record);
Map<String, Object> map = recordToMap(entry, key, record);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we're changing the class anyway, can we move away from using scanAll as this was deprecated a long time ago?

Comment on lines +14 to 19
@Getter
private long first;
@Getter
private long last;
@Getter
private final Date issued;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not mark these fields as final and put @Getter and @Setter (or @Data) on the class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants