rpuch commented on a change in pull request #523:
URL: https://github.com/apache/ignite-3/pull/523#discussion_r774973626
##########
File path:
modules/network/src/main/java/org/apache/ignite/internal/network/direct/stream/DirectByteBufferStreamImplV1.java
##########
@@ -1343,6 +1362,81 @@ public IgniteUuid readIgniteUuid() {
return map0;
}
+ /** {@inheritDoc} */
+ @Override
+ public <T> void writeMarshallable(T object, MessageWriter writer) {
+ switch (marshallableState) {
+ case 0:
Review comment:
It looks like these are stage numbers which are local to each method
using them. For example, in this case the stages are 'writing missing
descriptors' and 'writing marshalled object'. I still think that it would be
nice to explicitly name them and use something like `nextStage()` instead of
just `++`, and I think that this should be applied to those the class. But this
is probably too much in the context of this task, so probably such a
refactoring might be postponed (if needed at all).
##########
File path:
modules/network/src/main/java/org/apache/ignite/internal/network/direct/stream/DirectByteBufferStreamImplV1.java
##########
@@ -1343,6 +1362,81 @@ public IgniteUuid readIgniteUuid() {
return map0;
}
+ /** {@inheritDoc} */
+ @Override
+ public <T> void writeMarshallable(T object, MessageWriter writer) {
+ switch (marshallableState) {
+ case 0:
+ if (marshallable == null) {
+ // If object was not serialized to a byte array, serialize
it
+ SerializationResult res =
serializationService.writeMarshallable(object);
+ List<Integer> descriptorIds = res.ids();
+ marshallable = res.array();
+ // Get descriptors that were not previously sent to the
remote node
+ missingDescriptors =
serializationService.createClassDescriptorsMessages(descriptorIds);
+ }
+
+ writeCollection(missingDescriptors,
MessageCollectionItemType.MSG, writer);
+
+ if (!lastFinished) {
Review comment:
Oh, it turns out that `writeCollection()` (and every other `writeXXX`
here) is partial, so it's rather
`try-writing-part-of-XXX-with-resumption-next-time` :) So this looks correclty,
after all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]