-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
dbulaja98
reviewed
Mar 1, 2023
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
drmarjanovic
reviewed
Mar 1, 2023
modules/library/src/main/scala/zio/elasticsearch/ElasticRequest.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticResult.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticResult.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/TestExecutor.scala
Outdated
Show resolved
Hide resolved
drmarjanovic
requested changes
Mar 2, 2023
modules/example/src/main/scala/example/RepositoriesElasticsearch.scala
Outdated
Show resolved
Hide resolved
modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala
Outdated
Show resolved
Hide resolved
modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala
Outdated
Show resolved
Hide resolved
modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala
Outdated
Show resolved
Hide resolved
modules/library/src/it/scala/zio/elasticsearch/HttpExecutorSpec.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticResult.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/TestExecutor.scala
Outdated
Show resolved
Hide resolved
markaya
force-pushed
the
poc-refactor-remove-map
branch
from
March 3, 2023 11:47
952053b
to
5bdae16
Compare
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
drmarjanovic
requested changes
Mar 3, 2023
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
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)))) |
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.
Is this safe? Or we should use ZIO.attempt
?
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.
There is nothing that could fail inside succeed. Just creating chunk from list and mapping it into Item.
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticExecutor.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticExecutor.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticResult.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/ElasticResult.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
markaya
force-pushed
the
poc-refactor-remove-map
branch
from
March 3, 2023 13:46
1766511
to
0c13270
Compare
drmarjanovic
previously approved these changes
Mar 3, 2023
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
arnoldlacko
commented
Mar 3, 2023
arnoldlacko
commented
Mar 3, 2023
modules/library/src/main/scala/zio/elasticsearch/HttpElasticExecutor.scala
Outdated
Show resolved
Hide resolved
dbulaja98
reviewed
Mar 6, 2023
drmarjanovic
approved these changes
Mar 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 typeElasticRequestType
.This also makes bulk-requests more type-safe, as bulkable request types are now simply extending
BulkableRequest
.