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

Generate server skeleton code #138

Open
meling opened this issue Apr 14, 2021 · 1 comment
Open

Generate server skeleton code #138

meling opened this issue Apr 14, 2021 · 1 comment

Comments

@meling
Copy link
Member

meling commented Apr 14, 2021

Provide argument gorums_out=srv=<srvName>,paths=... to protoc-gen-gorums to generate skeleton server code. The generated code would be saved to a file srvname.go. Decide if we should support both source_relative and other options. If srvname.go already exists and is non-empty, it should not be overwritten unless explicitly forced.

type srvName struct {
}

func (s * srvName) Unicast(ctx context.Context, r *proto.Request) {
}

func (s * srvName) Multicast(ctx context.Context, r *proto.Request) {
}

func (s * srvName) QuorumCall(ctx context.Context, req *proto.Request, out func(*proto.Response, error)) {
	out(&proto.Response{
		Field: nil, // TODO initialize
	}, nil)
}
@meling
Copy link
Member Author

meling commented Apr 21, 2021

The default should be to generate server and client code templates unless they already exist. We could read an existing file, and check whether or not the method signatures still match, e.g. after a change, and warn the user.

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

No branches or pull requests

1 participant