-
Notifications
You must be signed in to change notification settings - Fork 25
Org Resolver in Initialise Depenencies loop wiring #1599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7ee95ee
adding org resolver to initialis
patrickhuie19 f7dcb7e
adding org resolver grpc wiring
patrickhuie19 669e225
using protoc v5.29.3
patrickhuie19 e517696
Merge branch 'main' into feat/org-resolver-loop-wiring
patrickhuie19 7c4e007
use services helper in loop implementor
patrickhuie19 780f512
fixing build issue
patrickhuie19 02912d0
other build issues
patrickhuie19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,48 @@ | ||
| package orgresolver | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "google.golang.org/grpc" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/services/orgresolver" | ||
| ) | ||
|
|
||
| var _ orgresolver.OrgResolver = (*Client)(nil) | ||
|
|
||
| type Client struct { | ||
| grpc pb.OrgResolverClient | ||
| } | ||
|
|
||
| func (c *Client) Get(ctx context.Context, owner string) (string, error) { | ||
| resp, err := c.grpc.Get(ctx, &pb.GetOrganizationRequest{Owner: owner}) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| return resp.OrganizationId, nil | ||
| } | ||
|
|
||
| func (c *Client) Start(_ context.Context) error { | ||
| return nil | ||
| } | ||
|
|
||
| func (c *Client) HealthReport() map[string]error { | ||
| return map[string]error{c.Name(): nil} | ||
| } | ||
|
|
||
| func (c *Client) Close() error { | ||
| return nil | ||
| } | ||
|
|
||
| func (c *Client) Name() string { | ||
| return "OrgResolverClient" | ||
| } | ||
|
|
||
| func (c *Client) Ready() error { | ||
| return nil | ||
| } | ||
|
|
||
| func NewClient(cc grpc.ClientConnInterface) *Client { | ||
| return &Client{grpc: pb.NewOrgResolverClient(cc)} | ||
| } | ||
patrickhuie19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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,27 @@ | ||
| package orgresolver | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/services/orgresolver" | ||
| ) | ||
|
|
||
| var _ pb.OrgResolverServer = (*Server)(nil) | ||
|
|
||
| type Server struct { | ||
| pb.UnimplementedOrgResolverServer | ||
| impl orgresolver.OrgResolver | ||
| } | ||
|
|
||
| func NewServer(impl orgresolver.OrgResolver) *Server { | ||
| return &Server{impl: impl} | ||
| } | ||
|
|
||
| func (s *Server) Get(ctx context.Context, req *pb.GetOrganizationRequest) (*pb.GetOrganizationResponse, error) { | ||
| orgID, err := s.impl.Get(ctx, req.Owner) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return &pb.GetOrganizationResponse{OrganizationId: orgID}, nil | ||
| } |
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,19 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| option go_package = "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb"; | ||
|
|
||
| package loop; | ||
|
|
||
| import "google/protobuf/empty.proto"; | ||
|
|
||
| message GetOrganizationRequest { | ||
| string owner = 1; | ||
| } | ||
|
|
||
| message GetOrganizationResponse { | ||
| string organization_id = 1; | ||
| } | ||
|
|
||
| service OrgResolver { | ||
| rpc Get(GetOrganizationRequest) returns (GetOrganizationResponse); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to implement
Service?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't, won't any consumer of the service in the capabilities get hit with a panic if they try to call these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/smartcontractkit/chainlink-common/pull/1599/files#r2414881990