-
Notifications
You must be signed in to change notification settings - Fork 13
Add metadataFormatIsEmpty in TarantoolTuple #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is OK by itself, just some wording and naming needs to be fixed.
But there is a greater question, do we need this change at all. It seems it is not comfortable to work with a tuple that represents in fact two different entities.
Could it be better if we derive a TarantoolTupleWithMetadata
interface from the original TarantoolTuple
one, move to the second one all methods that access fields by names, add the corresponding *Impl
class, and then use that interface distinction in SpringData via instanceof
? That will allow us to finally avoid all the checks for metadata presence that we have to use in current implementation, and the user confusion when they try to get a field by name and see a strange "metadata does not exist" error.
With that implementation, we can change the *Proxy*
API classes to return TarantoolTupleWithMetadata
tuples instead of TarantoolTuple
ones. That may also probably require changing the TarantoolTuple
interface somewhere either to Packable
or to ? extends TarantoolTuple
.
src/main/java/io/tarantool/driver/api/tuple/TarantoolTuple.java
Outdated
Show resolved
Hide resolved
src/main/java/io/tarantool/driver/api/tuple/TarantoolTuple.java
Outdated
Show resolved
Hide resolved
* | ||
* @return true if we obtain fields by names | ||
*/ | ||
boolean metadataFormatIsEmpty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using a simpler naming like hasMetadata
or isMetadataEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to hasMetadata
Co-authored-by: Alexey Kuzin <[email protected]>
Added ticket about splitting TarantoolTuple class to use for input and output(with/without metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have the same question, see below
* | ||
* @return true if we can obtain the tuple fields by names | ||
*/ | ||
boolean hasMetadata(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to use different types (TarantoolTuple
and TarantoolTupleWithMetadata
). do we really need this method then? It is a public API, we need to carefully think before changing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll break compatibility anyway. So I don't see a big problem to have hasMetadata now and then remove it. I want to sync springdata and cartridge-java as soon as possible, because we've already been being late
CHANGELOG.md
Outdated
## [Unreleased] | ||
- Remove config request timeout as default parameter in crud client | ||
- Add details for the case of space metadata fetching failure ([#200](https://github.com/tarantool/cartridge-java/issues/200)) | ||
- Add metadataFormatIsEmpty in TarantoolTuple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to change this entry too
OK. Let's amend this change in the nearest updates then. |
It's needed when we expected crud and box responses by one mapper(AUTO mapper in cartridge-springdata). In case when we obtain box response and we didn't have prepared metadata from ddl/_vspace, we can't map these values to Entity without metadata and we can't check whether we have it or not. And we can't raise an exception that we don't have metadata before because we can take it from crud response. Springdata doesn't see a difference between crud and box responses, it only got TarantoolTupleResult
I haven't forgotten about:
Related issues:
Needed for tarantool/cartridge-springdata#123