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

Remove Map and phantom type parameter ERT and support streaming #99

Merged
merged 14 commits into from
Mar 6, 2023

Conversation

arnoldlacko
Copy link
Contributor

This is a POC for removing Map as a request type. Parsing of the result into a user type is done upon retrieval, which means we no longer require the schema to be provided in advance (before execution).
Removing Map allows to make all the request types public and hence allows to remove the phantom type ElasticRequestType.
This also makes bulk-requests more type-safe, as bulkable request types are now simply extending BulkableRequest.

@arnoldlacko arnoldlacko marked this pull request as draft March 1, 2023 08:18
@drmarjanovic drmarjanovic changed the title Draft: POC for removing Map and phantom type parameter ERT POC for removing Map and phantom type parameter ERT Mar 1, 2023
@markaya markaya marked this pull request as ready for review March 3, 2023 11:40
@markaya markaya force-pushed the poc-refactor-remove-map branch from 952053b to 5bdae16 Compare March 3, 2023 11:47
@markaya markaya changed the title POC for removing Map and phantom type parameter ERT Remove Map and phantom type parameter ERT, add Streaming Mar 3, 2023
e => ZIO.fail(new ElasticException(s"Exception occurred: ${e.getMessage}")),
value =>
if (value.results.isEmpty) ZIO.succeed((Chunk.empty, None))
else ZIO.succeed((Chunk.fromIterable(value.results).map(Item), value.scrollId.orElse(Some(scrollId))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe? Or we should use ZIO.attempt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing that could fail inside succeed. Just creating chunk from list and mapping it into Item.

@markaya markaya force-pushed the poc-refactor-remove-map branch from 1766511 to 0c13270 Compare March 3, 2023 13:46
drmarjanovic
drmarjanovic previously approved these changes Mar 3, 2023
@drmarjanovic drmarjanovic changed the title Remove Map and phantom type parameter ERT, add Streaming Remove Map and phantom type parameter ERT and support streaming Mar 3, 2023
@drmarjanovic drmarjanovic merged commit cebe4f7 into main Mar 6, 2023
@drmarjanovic drmarjanovic deleted the poc-refactor-remove-map branch March 6, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants