[infinispan-issues] [JBoss JIRA] (ISPN-6307) Add datatype metadata script parameter for dealing with UTF-8 Strings

Galder Zamarreño (JIRA) issues at jboss.org
Wed Mar 2 11:35:00 EST 2016


Galder Zamarreño created ISPN-6307:
--------------------------------------

             Summary: Add datatype metadata script parameter for dealing with UTF-8 Strings
                 Key: ISPN-6307
                 URL: https://issues.jboss.org/browse/ISPN-6307
             Project: Infinispan
          Issue Type: Feature Request
          Components: Remote Protocols
            Reporter: Galder Zamarreño
            Assignee: Galder Zamarreño
            Priority: Blocker
             Fix For: 8.2.0.Final


Hot Rod's 'execute' operation is tightly coupled with JBoss Marshalling making it difficult to run an execute operation from Javascript, who currently supports plain, UTF-8 String keys and values.

The essence of the problem is that the server marshalls parameters and return values instead of having the client drive how these are marshalled. As a result of this, for a JS or C++ client to be able to use `exec` with default configuration, they need to understand JBoss Marshaller format, which is not good.

IOW, if a JS client sends a UTF-8 string as parameter, server tries to unmarshall it using the JBoss Marshaller and it fails. This happens because exec assumes the client is a Java client.
The same happens with the return value.

On top of that, the a script run from Javascript would be expect cached values to be Strings.

In order to accommodate the JS client's needs to support plain UTF-8 Strings, and also help C/C++ client, it was decided to add a new metadata parameter to the script called `datatype` which for JS scripts, it would take as value `utf8`.

When `datatype=utf8`, the following will happen:

1. Parameters to the script will be assumed to be UTF-8 Strings.
2. Cached values would be assumed to be Strings and a facade Cache implementation will internally make the conversion.
3. The return type of the script will be transformed into byte[] encoded as UTF-8 String.

When `datatype=utf8` is defined, no attempt to interoperate with data stored using a Java Hot Rod client or a REST client. To get such interoperability, compatibility mode would need to be enabled and both Java HR client and JS/C++ client would need to share the same marshaller. This is not yet in place but will come.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the infinispan-issues mailing list