CLIENT-4143 Restructure to support the new Java client#204
CLIENT-4143 Restructure to support the new Java client#204
Conversation
…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>
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
|
The build is stable and only missing fluent client dependency. |
| this.classConfig.setSendKey(sendKey); | ||
| return this; | ||
| } | ||
|
|
There was a problem hiding this comment.
Why is the shortName being removed? We still need this to put a smaller type in a list representation don't we?
| * 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). |
There was a problem hiding this comment.
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.
| if (bins != null && !entry.isKeyFieldStoredAsBin()) { | ||
| String keyFieldName = entry.getKeyFieldName(); | ||
| if (keyFieldName != null && rk.keyValue != null) { | ||
| bins = new HashMap<>(bins); | ||
| bins.put(keyFieldName, rk.keyValue); | ||
| } | ||
| } |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Does the PolicyCache take care of this?
| T result = entry.constructAndHydrate(map); | ||
| entry.setGenerationValue(result, record.generation); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Given we're changing the class anyway, can we move away from using scanAll as this was deprecated a long time ago?
| @Getter | ||
| private long first; | ||
| @Getter | ||
| private long last; | ||
| @Getter | ||
| private final Date issued; |
There was a problem hiding this comment.
Why not mark these fields as final and put @Getter and @Setter (or @Data) on the class?
No description provided.