Skip to content

Commit

Permalink
accepts topic from api
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Anderson <[email protected]>
  • Loading branch information
dmikey committed Feb 8, 2024
1 parent ea45f1f commit cd93722
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
}
Expand Down
3 changes: 2 additions & 1 deletion models/request/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion node/head_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit cd93722

Please sign in to comment.