-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix workflow and traversal remove manager
removing temporal and memory distinction for now until a clearer understanding of how to integrate
- Loading branch information
Chris
committed
Aug 21, 2023
1 parent
dfba71a
commit 65880db
Showing
53 changed files
with
1,566 additions
and
1,063 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package http | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/protoflow-labs/protoflow/gen/http" | ||
"github.com/protoflow-labs/protoflow/pkg/graph" | ||
"github.com/protoflow-labs/protoflow/pkg/graph/node/base" | ||
"github.com/protoflow-labs/protoflow/pkg/util/rx" | ||
"github.com/reactivex/rxgo/v2" | ||
) | ||
|
||
type Response struct { | ||
*base.Node | ||
*http.Response | ||
} | ||
|
||
var _ graph.Node = &Response{} | ||
|
||
func NewResponse(b *base.Node, node *http.Response) *Response { | ||
return &Response{ | ||
Node: b, | ||
Response: node, | ||
} | ||
} | ||
|
||
func (n *Response) Wire(ctx context.Context, input graph.IO) (graph.IO, error) { | ||
output := make(chan rxgo.Item) | ||
p, err := n.Provider() | ||
if err != nil { | ||
return graph.IO{}, err | ||
} | ||
routerResource, ok := p.(*Router) | ||
if !ok { | ||
return graph.IO{}, fmt.Errorf("error getting http router resource: %v", n.Response) | ||
} | ||
|
||
input.Observable.ForEach(func(item any) { | ||
r, ok := item.(*http.Response) | ||
if !ok { | ||
output <- rx.NewError(fmt.Errorf("error getting http request from stream")) | ||
return | ||
} | ||
routerResource.HTTPStream.Responses <- r | ||
output <- rx.NewItem(r) | ||
}, func(err error) { | ||
output <- rx.NewError(err) | ||
}, func() { | ||
close(output) | ||
}) | ||
|
||
return graph.IO{ | ||
Observable: rxgo.FromChannel(output, rxgo.WithPublishStrategy()), | ||
}, nil | ||
} |
Oops, something went wrong.