Skip to content
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

Support weakly typed data attributes #179

Closed
longquanzheng opened this issue Jul 6, 2023 · 6 comments
Closed

Support weakly typed data attributes #179

longquanzheng opened this issue Jul 6, 2023 · 6 comments
Assignees

Comments

@longquanzheng
Copy link
Contributor

longquanzheng commented Jul 6, 2023

Basically skip the type checking for those cases to be more flexible. In some case that user want to implement an dynamic workflow that may need dynamic data or search attributes (especially with persistence locking)

Another idea is to let user define data/search attribute with type by prefix:

DataAttributeDef.createByPrefix("UserInteger-", Integer.class)
@longquanzheng
Copy link
Contributor Author

Also need #180

@zklgame
Copy link
Contributor

zklgame commented Jul 18, 2023

Data attributes can be easily supported.

But search attributes need to be registered into the namespace, how could it be dynamically created during running time?

@zklgame
Copy link
Contributor

zklgame commented Jul 18, 2023

To support the createByPrefix for data attributes, we could:

  1. add a new filed isPrefix into DataAttributeDef.
  2. in registry, add a new Map<String, Map<String, Class<?>>> dataAttributePrefixToTypeStore field to record the prefixes seperately, so that when validating the keys, the time complexity could be O(N), where N is the count of prefixes.

@longquanzheng What do you think?

@longquanzheng
Copy link
Contributor Author

To support the createByPrefix for data attributes, we could:

  1. add a new filed isPrefix into DataAttributeDef.
  2. in registry, add a new Map<String, Map<String, Class<?>>> dataAttributePrefixToTypeStore field to record the prefixes seperately, so that when validating the keys, the time complexity could be O(N), where N is the count of prefixes.

@longquanzheng What do you think?

That looks good to me. I would probably do the same way as you described

@longquanzheng
Copy link
Contributor Author

Also I just realized that getAllDataObjects will be broken for now after this change. We may just add a comment for this behavior as edge case. (In fact, I think this API is not too important to have anyway)

@zklgame
Copy link
Contributor

zklgame commented Jul 19, 2023

Data attribute support in #189.

@longquanzheng longquanzheng changed the title Support weakly typed data and search attributes Support weakly typed data attributes Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants