Generate server skeleton code
meling opened this issue · 1 comments
meling commented
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 commented
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.