refactor(runtime,core): split router service (#20401)

This commit is contained in:
Julien Robert
2024-05-16 08:04:40 +00:00
committed by GitHub
parent 6b716eef9a
commit f02a124667
41 changed files with 117 additions and 156 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ type Environment struct {
EventService event.Service
GasService gas.Service
HeaderService header.Service
RouterService router.Service
QueryRouterService router.Service
MsgRouterService router.Service
TransactionService transaction.Service
KVStoreService store.KVStoreService
+2 -8
View File
@@ -6,15 +6,9 @@ import (
"google.golang.org/protobuf/runtime/protoiface"
)
// Service embeds a QueryRouterService and MessageRouterService.
// Each router allows to invoke messages and queries via the corresponding router.
// Service is the interface that wraps the basic methods for a router.
// A router can be a query router or a message router.
type Service interface {
QueryRouterService() Router
MessageRouterService() Router
}
// Router is the interface that wraps the basic methods for a router.
type Router interface {
// CanInvoke returns an error if the given request cannot be invoked.
CanInvoke(ctx context.Context, typeURL string) error
// InvokeTyped execute a message or query. It should be used when the called knows the type of the response.