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
522ebba0
Commit
522ebba0
authored
Dec 22, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust start flow
parent
99fb481c
Pipeline
#8394
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
sidecar.go
internal/app/sidecar.go
+6
-5
local.go
internal/peermgr/local.go
+2
-2
No files found.
internal/app/sidecar.go
View file @
522ebba0
...
@@ -59,16 +59,17 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
...
@@ -59,16 +59,17 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
r
:=
router
.
NewRouter
(
privateKey
,
loggers
.
Logger
(
loggers
.
Router
))
r
:=
router
.
NewRouter
(
privateKey
,
loggers
.
Logger
(
loggers
.
Router
))
pm
,
err
:=
peermgr
.
New
(
config
,
r
,
nodePrivKey
,
privateKey
,
1
,
loggers
.
Logger
(
loggers
.
PeerMgr
))
pm
,
err
:=
peermgr
.
New
(
config
,
r
,
nodePrivKey
,
privateKey
,
1
,
loggers
.
Logger
(
loggers
.
PeerMgr
))
tool
.
Asset
(
err
)
tool
.
Asset
(
err
)
clients
:=
plugins
.
CreateClients
(
config
.
Appchains
,
nil
)
persister
:=
manager
.
NewPersister
(
addr
.
String
(),
store
,
loggers
.
Logger
(
loggers
.
Manager
))
persister
:=
manager
.
NewPersister
(
addr
.
String
(),
store
,
loggers
.
Logger
(
loggers
.
Manager
))
appchainMgr
:=
appchainmgr
.
New
(
persister
)
appchainMgr
:=
appchainmgr
.
New
(
persister
)
rule
:=
rulemgr
.
New
(
store
,
loggers
.
Logger
(
loggers
.
RuleMgr
))
mg
,
err
:=
manager
.
NewManager
(
addr
.
String
(),
pm
,
appchainMgr
,
rule
,
loggers
.
Logger
(
loggers
.
Manager
))
clients
:=
plugins
.
CreateClients
(
config
.
Appchains
,
nil
)
// TODO hub client
// TODO hub client
// privateKey DH
// privateKey DH
cryptor
:=
txcrypto
.
NewCryptor
(
nil
,
appchainMgr
,
privateKey
)
cryptor
:=
txcrypto
.
NewCryptor
(
nil
,
appchainMgr
,
privateKey
)
managerPort
:=
appchain
.
NewManager
(
clients
,
cryptor
,
logger
)
managerPort
:=
appchain
.
NewManager
(
clients
,
cryptor
,
logger
)
r
.
Adds
(
managerPort
.
Ports
())
r
.
Adds
(
managerPort
.
Ports
())
rule
:=
rulemgr
.
New
(
store
,
loggers
.
Logger
(
loggers
.
RuleMgr
))
mg
,
err
:=
manager
.
NewManager
(
addr
.
String
(),
pm
,
appchainMgr
,
rule
,
loggers
.
Logger
(
loggers
.
Manager
))
tool
.
Asset
(
err
)
tool
.
Asset
(
err
)
apiServer
:=
api
.
NewServer
(
config
,
r
,
loggers
.
Logger
(
loggers
.
ApiServer
))
apiServer
:=
api
.
NewServer
(
config
,
r
,
loggers
.
Logger
(
loggers
.
ApiServer
))
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
...
@@ -86,7 +87,7 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
...
@@ -86,7 +87,7 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
// Start starts three main components of sidecar app
// Start starts three main components of sidecar app
func
(
s
*
App
)
Start
()
error
{
func
(
s
*
App
)
Start
()
error
{
if
err
:=
s
.
apiServ
er
.
Start
();
err
!=
nil
{
if
err
:=
s
.
mang
er
.
Start
();
err
!=
nil
{
return
err
return
err
}
}
...
@@ -94,7 +95,7 @@ func (s *App) Start() error {
...
@@ -94,7 +95,7 @@ func (s *App) Start() error {
return
err
return
err
}
}
return
s
.
mang
er
.
Start
()
return
s
.
apiServ
er
.
Start
()
}
}
// Stop stops three main components of sidecar app
// Stop stops three main components of sidecar app
...
...
internal/peermgr/local.go
View file @
522ebba0
...
@@ -51,7 +51,7 @@ func (l *localPeer) Tag() string {
...
@@ -51,7 +51,7 @@ func (l *localPeer) Tag() string {
return
l
.
tag
return
l
.
tag
}
}
// 需要同步处理的数据,主要用于处理接收的其它sidecar port 、外部API返回数据。
//
Send
需要同步处理的数据,主要用于处理接收的其它sidecar port 、外部API返回数据。
func
(
l
*
localPeer
)
Send
(
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
func
(
l
*
localPeer
)
Send
(
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
// 同步完成
// 同步完成
switch
msg
.
Type
{
switch
msg
.
Type
{
...
@@ -64,7 +64,7 @@ func (l *localPeer) Send(msg *pb.Message) (*pb.Message, error) {
...
@@ -64,7 +64,7 @@ func (l *localPeer) Send(msg *pb.Message) (*pb.Message, error) {
return
nil
,
nil
return
nil
,
nil
}
}
// 需要异步处理的数据
//
AsyncSend
需要异步处理的数据
func
(
l
*
localPeer
)
AsyncSend
(
msg
*
pb
.
Message
)
error
{
func
(
l
*
localPeer
)
AsyncSend
(
msg
*
pb
.
Message
)
error
{
// 先获取消息类型,做出判断是否路由,判断是异步还是同步。
// 先获取消息类型,做出判断是否路由,判断是异步还是同步。
// 然后做出IBTPX消息,对from、to做路由判断,以及同步异步完成。
// 然后做出IBTPX消息,对from、to做路由判断,以及同步异步完成。
...
...
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