-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the StreamingQuery approach to handle long exports (#4820)
* Use the StreamingQuery approach to handle long exports * Scalafmt --------- Co-authored-by: Simon Dumas <[email protected]>
- Loading branch information
Showing
9 changed files
with
77 additions
and
61 deletions.
There are no files selected for viewing
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
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
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
44 changes: 44 additions & 0 deletions
44
...urcing-psql/src/main/scala/ch/epfl/bluebrain/nexus/delta/sourcing/exporter/RowEvent.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ch.epfl.bluebrain.nexus.delta.sourcing.exporter | ||
|
||
import ch.epfl.bluebrain.nexus.delta.rdf.IriOrBNode.Iri | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.model.{EntityType, Label} | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.offset.Offset | ||
import doobie.Read | ||
import io.circe.{Codec, Decoder, Encoder, Json} | ||
|
||
import java.time.Instant | ||
import scala.annotation.nowarn | ||
|
||
final case class RowEvent( | ||
ordering: Offset.At, | ||
`type`: EntityType, | ||
org: Label, | ||
project: Label, | ||
id: Iri, | ||
rev: Int, | ||
value: Json, | ||
instant: Instant | ||
) | ||
|
||
object RowEvent { | ||
|
||
@nowarn("cat=unused") | ||
implicit final val inputEventEncoder: Codec[RowEvent] = { | ||
import io.circe.generic.extras.Configuration | ||
import io.circe.generic.extras.semiauto.deriveConfiguredCodec | ||
implicit val offsetEncoder: Encoder[Offset.At] = Encoder.encodeLong.contramap(_.value) | ||
implicit val offsetDecoder: Decoder[Offset.At] = Decoder.decodeLong.map(Offset.At) | ||
implicit val config: Configuration = Configuration.default | ||
deriveConfiguredCodec[RowEvent] | ||
} | ||
|
||
implicit val inputEventRead: Read[RowEvent] = { | ||
import doobie._ | ||
import doobie.postgres.implicits._ | ||
import ch.epfl.bluebrain.nexus.delta.sourcing.implicits._ | ||
Read[(Long, EntityType, Label, Label, Iri, Int, Json, Instant)].map { | ||
case (offset, entityType, org, project, id, rev, value, instant) => | ||
RowEvent(Offset.At(offset), entityType, org, project, id, rev, value, instant) | ||
} | ||
} | ||
} |
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
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
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
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
32 changes: 0 additions & 32 deletions
32
ship/src/main/scala/ch/epfl/bluebrain/nexus/ship/model/InputEvent.scala
This file was deleted.
Oops, something went wrong.