You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Stanislav Lukyanov (Jira)" <ji...@apache.org> on 2025/03/18 22:36:00 UTC
[jira] [Updated] (IGNITE-22645) C++ Client Marshaler API
[ https://issues.apache.org/jira/browse/IGNITE-22645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stanislav Lukyanov updated IGNITE-22645:
----------------------------------------
Epic Link: IGNITE-22146 (was: IGNITE-19848)
> C++ Client Marshaler API
> ------------------------
>
> Key: IGNITE-22645
> URL: https://issues.apache.org/jira/browse/IGNITE-22645
> Project: Ignite
> Issue Type: Improvement
> Reporter: Aleksandr
> Assignee: Igor Sapego
> Priority: Major
> Labels: ignite-3
>
> Compute API provides JobDescriptor in java https://github.com/apache/ignite-3/blob/7dedc06ea25b9c63dcdfb69290c7862c754a0d8f/modules/api/src/main/java/org/apache/ignite/compute/JobDescriptor.java#L29
> With this api I can define argument and result marshallers in the java client:
> {code:java}
> String result = compute.execute(
> JobTarget.node(targetNode),
> JobDescriptor.builder(ArgMarshalingJob.class)
> .argumentMarshaller(new ArgumentStringMarshaller())
> .resultMarshaller(new ResultStringUnMarshaller())
> .build(),
> "Input"
> );
> // ...
> static class ArgumentStringMarshaller implements ByteArrayMarshaler<String> {
> @Override
> public byte @Nullable [] marshal(@Nullable String object) {
> return ByteArrayMarshaler.super.marshal(object + ":marshalledOnClient");
> }
> }
> static class ResultStringUnMarshaller implements ByteArrayMarshaler<String> {
> @Override
> public @Nullable String unmarshal(byte @Nullable [] raw) {
> return ByteArrayMarshaler.super.unmarshal(raw) + ":unmarshalledOnClient";
> }
> }
> {code}
> Argument marshaller is called on the client side during job argument packing, so, the argument is sent as marshalled byte[]. Result marhaller unmarshalls the result from the job from byte[] to the target type.
> Invariant: If one has defined argument/result marshaller in JobDescriptor then they must define argument/result marshaller in the compute job.
> By default marshallers are null everywhere. Null means "No marshaller defined", the existing serialization is used. More in IEP: https://cwiki.apache.org/confluence/display/IGNITE/IEP-124%3A+User+Object+Serialization
--
This message was sent by Atlassian Jira
(v8.20.10#820010)