diff --git a/api/execute.go b/api/execute.go index 0e1362fd..595f52a2 100644 --- a/api/execute.go +++ b/api/execute.go @@ -16,7 +16,7 @@ import ( // ExecuteRequest describes the payload for the REST API request for function execution. type ExecuteRequest struct { execute.Request - Subgroup string `json:"subgroup,omitempty"` + Topic string `json:"topic,omitempty"` } // ExecuteResponse describes the REST API response for function execution. @@ -47,7 +47,7 @@ func (a *API) Execute(ctx echo.Context) error { } // Get the execution result. - code, id, results, cluster, err := a.Node.ExecuteFunction(ctx.Request().Context(), execute.Request(req.Request), req.Subgroup) + code, id, results, cluster, err := a.Node.ExecuteFunction(ctx.Request().Context(), execute.Request(req.Request), req.Topic) if err != nil { a.Log.Warn().Str("function", req.FunctionID).Err(err).Msg("node failed to execute function") } diff --git a/models/request/execute.go b/models/request/execute.go index b401e14d..2b4c9741 100644 --- a/models/request/execute.go +++ b/models/request/execute.go @@ -13,7 +13,8 @@ type Execute struct { Type string `json:"type,omitempty"` From peer.ID `json:"from,omitempty"` Code string `json:"code,omitempty"` - + Topic string `json:"topic,omitempty"` + execute.Request // execute request is embedded. // RequestID may be set initially, if the execution request is relayed via roll-call. diff --git a/node/head_execute.go b/node/head_execute.go index a72a183a..227df978 100644 --- a/node/head_execute.go +++ b/node/head_execute.go @@ -35,7 +35,7 @@ func (n *Node) headProcessExecute(ctx context.Context, from peer.ID, payload []b log := n.log.With().Str("request", req.RequestID).Str("peer", from.String()).Str("function", req.FunctionID).Logger() - code, results, cluster, err := n.headExecute(ctx, requestID, req.Request, "") + code, results, cluster, err := n.headExecute(ctx, requestID, req.Request, req.Topic) if err != nil { log.Error().Err(err).Msg("execution failed") }