Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Creates a base container providing request metadata #154

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

vendamere
Copy link
Contributor

@vendamere vendamere commented Dec 7, 2022

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.

@vendamere vendamere force-pushed the metadata/provide-metadata branch 3 times, most recently from bcd1af7 to 3b9053a Compare December 7, 2022 21:09
object CosmosContainer {

private class IMapKCosmosContainer[F[_], G[_], Key, Id, StreamResult[_], QueryValue, SingleResult[
_

Choose a reason for hiding this comment

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

scalafmt, I assume?

Copy link
Contributor Author

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 {
Copy link
Contributor

@peterneyens peterneyens Dec 8, 2022

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 Chunks that correspond to the pages. Tthat is why we traversed 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)

Copy link
Contributor Author

@vendamere vendamere Dec 8, 2022

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 =>
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@vendamere vendamere force-pushed the metadata/provide-metadata branch from 3b9053a to a34641e Compare December 8, 2022 16:31
@vendamere vendamere merged commit 1d3c0bc into series/1.0 Dec 9, 2022
@vendamere vendamere deleted the metadata/provide-metadata branch December 9, 2022 20:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants