Skip to content

Commit

Permalink
add graph config to data request (Netflix#1512)
Browse files Browse the repository at this point in the history
This is sometimes useful to provide more context to the
data layer such as passing through the query id.
  • Loading branch information
brharrington authored and manolama committed May 22, 2024
1 parent d2c0414 commit 17f8f87
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ class GraphApi(config: Config, implicit val actorRefFactory: ActorRefFactory) ex

object GraphApi {

case class DataRequest(context: EvalContext, exprs: List[DataExpr])
case class DataRequest(
context: EvalContext,
exprs: List[DataExpr],
config: Option[GraphConfig] = None
)

object DataRequest {

def apply(config: GraphConfig): DataRequest = {
val dataExprs = config.exprs.flatMap(_.expr.dataExprs)
val deduped = dataExprs.distinct
DataRequest(config.evalContext, deduped)
DataRequest(config.evalContext, deduped, Option(config))
}
}

Expand Down

0 comments on commit 17f8f87

Please sign in to comment.