[
https://issues.apache.org/jira/browse/IGNITE-8014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16411853#comment-16411853
]
Alexey Kosenchuk edited comment on IGNITE-8014 at 3/23/18 6:29 PM:
-------------------------------------------------------------------
[~vozerov] thanks for the comments...
> 1) CacheClient - what is the purpose of setKeyType and setValueType methods
> from user perspective?
To be able to specify the Binary Protocol types (at least, types codes) of keys
and values which user plans to send/receive.
Their usage is optional.
When the types are not explicitly specified, the client will do automatic
mapping between some of the JavaScript types and the Binary Protocol types (the
mapping table is described in the header of the ObjectType class).
But this mapping may not satisfy user's needs.
For example, javascript has only one numeric type (number) that is standard
double. But user may want to send the protocol's INT, not DOUBLE.
Alternatively, every send/receive method could have the types (type codes)
specification parameters. But that seems excessive.
User still can send/receive data of different types to/from the same cache:
a) either call setKeyType()/setValueType() methods to change the types before
sending/receiving.
b) or use different CacheClient instances operated with the same cache, and
set different key/value types in different instances.
c) or use automatic mapping only if it's enough.
> 2) Errors - typically we try to have as least different error types as
> possible.
Fully agree with this approach.
> IllegalStateError, LostConnectionError - appears to be the same thing -
> client is not connected; I would merge it into a single entity
They are different.
IllegalStateError means an operation is not started at all (a request was not
sent to the server).
LostConnectionError means an operation was started (a request was sent to the
server) but is not completed as the connection is lost (so, the response is not
received).
We believe it is an important difference for user.
Will try to explain this more clearly in the comments.
> InternalError - I doubt user has any chance to react to this error in any way
> except of logging or rethrowing; I would remove it and use base
> IgniteClientError instead
The only reason was some consistency - base class error is never thrown, only
subclasses. But this is not a strong reason)))
Actually, IllegalArgumentError, TypeCastError, UnsupportedTypeError are
unlikely can be processed by user either. Usually just logged for debug purpose.
Theoretically they also can be substituted by IgniteClientError with different
messages.
was (Author: alexey.kosenchuk):
> 1) CacheClient - what is the purpose of setKeyType and setValueType methods
> from user perspective?
To be able to specify the Binary Protocol types (at least, types codes) of keys
and values which user plans to send/receive.
Their usage is optional.
When the types are not explicitly specified, the client will do automatic
mapping between some of the JavaScript types and the Binary Protocol types (the
mapping table is described in the header of the ObjectType class).
But this mapping may not satisfy user's needs.
For example, javascript has only one numeric type (number) that is standard
double. But user may want to send the protocol's INT, not DOUBLE.
Alternatively, every send/receive method could have the types (type codes)
specification parameters. But that seems excessive.
User still can send/receive data of different types to/from the same cache:
a) either call setKeyType()/setValueType() methods to change the types before
sending/receiving.
b) or use different CacheClient instances operated with the same cache, and
set different key/value types in different instances.
c) or use automatic mapping only if it's enough.
> 2) Errors - typically we try to have as least different error types as
> possible.
Fully agree with this approach.
> IllegalStateError, LostConnectionError - appears to be the same thing -
> client is not connected; I would merge it into a single entity
They are different.
IllegalStateError means an operation is not started at all (a request was not
sent to the server).
LostConnectionError means an operation was started (a request was sent to the
server) but is not completed as the connection is lost (so, the response is not
received).
We believe it is an important difference for user.
Will try to explain this more clearly in the comments.
> InternalError - I doubt user has any chance to react to this error in any way
> except of logging or rethrowing; I would remove it and use base
> IgniteClientError instead
The only reason was some consistency - base class error is never thrown, only
subclasses. But this is not a strong reason)))
Actually, IllegalArgumentError, TypeCastError, UnsupportedTypeError are
unlikely can be processed by user either. Usually just logged for debug purpose.
Theoretically they also can be substituted by IgniteClientError with different
messages.
> Node.js client: basic/minimal version
> -------------------------------------
>
> Key: IGNITE-8014
> URL: https://issues.apache.org/jira/browse/IGNITE-8014
> Project: Ignite
> Issue Type: Sub-task
> Components: thin client
> Reporter: Alexey Kosenchuk
> Assignee: Alexey Kosenchuk
> Priority: Major
>
> Develop the first basic/minimal version - for initial review/feedback.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)