forked from unionj-cloud/go-doudou
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Apr 15, 2024
1 parent
ed45723
commit 5a8b136
Showing
3 changed files
with
8 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
package plugin | ||
|
||
import ( | ||
"github.com/elliotchance/orderedmap/v2" | ||
"github.com/unionj-cloud/go-doudou/v2/framework/grpcx" | ||
"github.com/unionj-cloud/go-doudou/v2/framework/rest" | ||
"github.com/unionj-cloud/go-doudou/v2/toolkit/pipeconn" | ||
) | ||
|
||
var servicePlugins = map[string]ServicePlugin{} | ||
var servicePlugins = orderedmap.NewOrderedMap[string, ServicePlugin]() | ||
|
||
type ServicePlugin interface { | ||
Initialize(restServer *rest.RestServer, grpcServer *grpcx.GrpcServer, dialCtx pipeconn.DialContextFunc) | ||
GetName() string | ||
Close() | ||
GoDoudouServicePlugin() | ||
GetServiceInstance() interface{} | ||
} | ||
|
||
func RegisterServicePlugin(plugin ServicePlugin) { | ||
servicePlugins[plugin.GetName()] = plugin | ||
servicePlugins.Set(plugin.GetName(), plugin) | ||
} | ||
|
||
func GetServicePlugins() map[string]ServicePlugin { | ||
func GetServicePlugins() *orderedmap.OrderedMap[string, ServicePlugin] { | ||
return servicePlugins | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters