Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
sidecar
Commits
4f1fe325
Commit
4f1fe325
authored
Dec 06, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed plugin client init
parent
3b565572
Pipeline
#8342
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
grpc.go
pkg/plugins/grpc.go
+8
-6
start.go
pkg/plugins/start.go
+5
-2
No files found.
pkg/plugins/grpc.go
View file @
4f1fe325
...
@@ -143,6 +143,7 @@ type GRPCClient struct {
...
@@ -143,6 +143,7 @@ type GRPCClient struct {
doneContext
context
.
Context
doneContext
context
.
Context
kernel
Kernel
kernel
Kernel
DID
string
DID
string
TypeName
string
}
}
func
(
g
*
GRPCClient
)
Initialize
(
configPath
string
,
ID
string
,
extra
[]
byte
)
error
{
func
(
g
*
GRPCClient
)
Initialize
(
configPath
string
,
ID
string
,
extra
[]
byte
)
error
{
...
@@ -327,12 +328,13 @@ func (g *GRPCClient) Name() string {
...
@@ -327,12 +328,13 @@ func (g *GRPCClient) Name() string {
}
}
func
(
g
*
GRPCClient
)
Type
()
string
{
func
(
g
*
GRPCClient
)
Type
()
string
{
response
,
err
:=
g
.
client
.
Type
(
g
.
doneContext
,
&
pb
.
Empty
{})
//response, err := g.client.Type(g.doneContext, &pb.Empty{})
if
err
!=
nil
{
//if err != nil {
return
""
// return ""
}
//}
//
return
response
.
Type
//return response.Type
return
g
.
TypeName
}
}
func
(
g
*
GRPCClient
)
Bind
(
kern
Kernel
)
{
func
(
g
*
GRPCClient
)
Bind
(
kern
Kernel
)
{
...
...
pkg/plugins/start.go
View file @
4f1fe325
...
@@ -73,6 +73,9 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
...
@@ -73,6 +73,9 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
tool
.
Asset
(
err
)
tool
.
Asset
(
err
)
var
clients
[]
Client
var
clients
[]
Client
for
_
,
appchainConfig
:=
range
appchainConfigs
{
for
_
,
appchainConfig
:=
range
appchainConfigs
{
if
!
appchainConfig
.
Enable
{
continue
}
pluginConfigPath
:=
filepath
.
Join
(
rootPath
,
"plugins"
,
appchainConfig
.
Config
)
pluginConfigPath
:=
filepath
.
Join
(
rootPath
,
"plugins"
,
appchainConfig
.
Config
)
pluginPath
:=
filepath
.
Join
(
rootPath
,
"plugins"
,
appchainConfig
.
Plugin
)
pluginPath
:=
filepath
.
Join
(
rootPath
,
"plugins"
,
appchainConfig
.
Plugin
)
_
,
err
=
os
.
Stat
(
pluginPath
)
_
,
err
=
os
.
Stat
(
pluginPath
)
...
@@ -99,16 +102,16 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
...
@@ -99,16 +102,16 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
// Request the plugin
// Request the plugin
raw
,
err
:=
rpcClient
.
Dispense
(
appchainConfig
.
Plugin
)
raw
,
err
:=
rpcClient
.
Dispense
(
appchainConfig
.
Plugin
)
tool
.
Asset
(
err
)
tool
.
Asset
(
err
)
var
client
Client
var
client
*
GRPC
Client
switch
raw
.
(
type
)
{
switch
raw
.
(
type
)
{
case
*
GRPCClient
:
case
*
GRPCClient
:
client
=
raw
.
(
*
GRPCClient
)
client
=
raw
.
(
*
GRPCClient
)
default
:
default
:
tool
.
Asset
(
fmt
.
Errorf
(
"unsupported kernel type"
))
tool
.
Asset
(
fmt
.
Errorf
(
"unsupported kernel type"
))
}
}
// initialize our kernel plugin
// initialize our kernel plugin
err
=
client
.
Initialize
(
pluginConfigPath
,
appchainConfig
.
DID
,
extra
)
err
=
client
.
Initialize
(
pluginConfigPath
,
appchainConfig
.
DID
,
extra
)
client
.
TypeName
=
appchainConfig
.
Type
//TODO
tool
.
Asset
(
err
)
tool
.
Asset
(
err
)
client
.
Bind
(
kernel
)
client
.
Bind
(
kernel
)
clients
=
append
(
clients
,
client
)
clients
=
append
(
clients
,
client
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment