feat(core): add register services extension interface (#14605)
This commit is contained in:
parent
66fa90292c
commit
07d38efffb
@ -1,6 +1,9 @@
|
||||
package appmodule
|
||||
|
||||
import "cosmossdk.io/depinject"
|
||||
import (
|
||||
"cosmossdk.io/depinject"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// AppModule is a tag interface for app module implementations to use as a basis
|
||||
// for extension interfaces. It provides no functionality itself, but is the
|
||||
@ -12,3 +15,23 @@ type AppModule interface {
|
||||
// IsAppModule is a dummy method to tag a struct as implementing an AppModule.
|
||||
IsAppModule()
|
||||
}
|
||||
|
||||
// HasServices is the extension interface that modules should implement to register
|
||||
// implementations of services defined in .proto files.
|
||||
type HasServices interface {
|
||||
AppModule
|
||||
|
||||
// RegisterServices registers the module's services with the app's service
|
||||
// registrar.
|
||||
//
|
||||
// Two types of services are currently supported:
|
||||
// - read-only gRPC query services, which are the default.
|
||||
// - transaction message services, which must have the protobuf service
|
||||
// option "cosmos.msg.v1.service" (defined in "cosmos/msg/v1/service.proto")
|
||||
// set to true.
|
||||
//
|
||||
// The service registrar will figure out which type of service you are
|
||||
// implementing based on the presence (or absence) of protobuf options. You
|
||||
// do not need to specify this in golang code.
|
||||
RegisterServices(grpc.ServiceRegistrar)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user