devsisters / shardcake

Sharding and location transparency for Scala
https://devsisters.github.io/shardcake/
Apache License 2.0
389 stars 30 forks source link

Allow broadcast responses (2.x) #37

Closed ghostdogpr closed 1 year ago

gregor-rayman commented 1 year ago

The responses are a good idea, the question is, how to handle situations, when some pods respond and some don't. Perhaps the error type for the broadcast could be something like case class PartialResponse(results: Map[Pod, Try[Res]]) extends Exception ?

ghostdogpr commented 1 year ago

Maybe UIO[Map[PodAddress, Either[Throwable, Res]]]

gregor-rayman commented 1 year ago

The UIO[Map[Pod, Either[Throwable, Res]]] is probably the most precise response. (Perhaps Try instead of Either?). The question is whether the success case should be more prominent in the result type and this precise list of error/partial successes could be returned only in the error case? (IO[Map[Pod, Try[Res]], Map[Pod, Res]]).

ghostdogpr commented 1 year ago

Agreed on Try. I think a single Map would be more convenient.

gregor-rayman commented 1 year ago

I am trying to write an EndToEnd test with 3 pods (one broadcasting, two listening) but I am struggling a bit :(

gregor-rayman commented 1 year ago

I have tested various situations manually and I have not found any issue :)

ghostdogpr commented 1 year ago

Will merge and try to apply the snapshot to my work case