-
Notifications
You must be signed in to change notification settings - Fork 1
Creates a base container providing request metadata #154
Conversation
bcd1af7
to
3b9053a
Compare
object CosmosContainer { | ||
|
||
private class IMapKCosmosContainer[F[_], G[_], Key, Id, StreamResult[_], QueryValue, SingleResult[ | ||
_ |
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.
scalafmt, I assume?
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.
Yep.
.iterable(elements.asScala) | ||
.traverse(jacksonToCirce(_).as[A]) | ||
.fold(Stream.raiseError[F] _, Stream.chunk(_)) | ||
.evalMapFilter { |
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 will break up the Chunk
s that correspond to the pages. Tthat is why we traverse
d the Chunk
directly before.
Similar for handleResultMeta
.
There is evalMapChunk
that preservers chunks by traversing the chunk, but there is no equivalent for evalMapFilter
, maybe we need to define that ourselves here?
(we had a similar issue before in #75)
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 replaced it with a collect and evalMapChunk.
.fold(Stream.raiseError[F], Stream.chunk) | ||
Stream.exec(handleDiagnostics(page.getCosmosDiagnostics())) ++ stream | ||
.handleDiagnostics(handleDiagnostics) | ||
.evalMap { json => |
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 probably want evalMapChunk
here (but for it to be useful handleDiagnostics
would need to preserver the chunks as well)
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.
Done.
3b9053a
to
a34641e
Compare
Refactors Raw and Indexed containers to use the base container
Removes partition key from upsert function in indexed container that isn't used or applicable.