Skip to content
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

Move all rmb handlers to api-gateway #2223

Merged
merged 10 commits into from
May 24, 2024
Merged

Move all rmb handlers to api-gateway #2223

merged 10 commits into from
May 24, 2024

Conversation

AbdelrahmanElawady
Copy link
Contributor

Description

Move all rmb handlers to api-gateway and use peer.Router instead of using rmb-peer binary.

Changes

  • All defined handlers and endpoints are now found under pkg/api-gateway.
  • Unimplemented endpoints reply immediately that it's not implemented.

Related Issues

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstring

Copy link
Member

@muhamadazmy muhamadazmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job Abderahman. I only have few comments below. We need to also make this is well tested before we deploy to devnet.

manager,
router.Serve,
peer.WithKeyType(peer.KeyTypeEd25519),
peer.WithRelay(environment.MustGet().RelayURL[0]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to support having multiple relays. This is probably need to be modified in the sdk peer already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it's already being done here

func (g *apiGateway) networkPublicConfigGetHandler(ctx context.Context, payload []byte) (interface{}, error) {
return g.networkerStub.GetPublicConfig(ctx)
}
func (g *apiGateway) networkInterfacesHandler(ctx context.Context, payload []byte) (interface{}, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just wondering if this logic should be part of the api, or networkd. I mean the api here shows understanding of the internals of some network internals.

Just a thought, no need to modify it immediately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's mostly preparing input for networkd and parsing its output so it isn't really a lot of networking logic, that's why I didn't move it.

log.Fatal().Err(err).Msg("unexpected error")
}
}()
server.Register(zbus.ObjectID{Name: "host", Version: "0.0.1"}, perfMon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a double register of the object host ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the return error from register. this should return an error because you trying to register an object with the same id

ashraffouda
ashraffouda previously approved these changes May 22, 2024
@muhamadazmy muhamadazmy merged commit 4259ba2 into main May 24, 2024
24 checks passed
@muhamadazmy muhamadazmy deleted the api-gateway-rmb branch May 24, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants