Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
6baa7257
Commit
6baa7257
authored
Feb 19, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5954b705
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
go/neo/storage.go
go/neo/storage.go
+9
-9
No files found.
go/neo/storage.go
View file @
6baa7257
...
@@ -78,6 +78,11 @@ func (stor *Storage) Run(ctx context.Context, l xnet.Listener) (err error) {
...
@@ -78,6 +78,11 @@ func (stor *Storage) Run(ctx context.Context, l xnet.Listener) (err error) {
log
.
Infof
(
ctx
,
"%s: listening on %s ..."
,
stor
.
node
.
MyInfo
.
NID
,
addr
)
log
.
Infof
(
ctx
,
"%s: listening on %s ..."
,
stor
.
node
.
MyInfo
.
NID
,
addr
)
stor
.
runCtx
=
ctx
stor
.
runCtx
=
ctx
defer
func
()
{
__
:=
stor
.
back
.
Close
()
err
=
xerr
.
First
(
err
,
__
)
}()
// update our serving address in node
// update our serving address in node
naddr
,
err
:=
proto
.
Addr
(
addr
)
naddr
,
err
:=
proto
.
Addr
(
addr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -85,21 +90,16 @@ func (stor *Storage) Run(ctx context.Context, l xnet.Listener) (err error) {
...
@@ -85,21 +90,16 @@ func (stor *Storage) Run(ctx context.Context, l xnet.Listener) (err error) {
}
}
stor
.
node
.
MyInfo
.
Addr
=
naddr
stor
.
node
.
MyInfo
.
Addr
=
naddr
// wrap listener with link / identificaton hello checker
// wrap listener with link / identificat
i
on hello checker
stor
.
lli
=
xneo
.
NewListener
(
neonet
.
NewLinkListener
(
l
))
stor
.
lli
=
xneo
.
NewListener
(
neonet
.
NewLinkListener
(
l
))
defer
func
()
{
defer
func
()
{
__
:=
stor
.
lli
.
Close
()
__
:=
stor
.
lli
.
Close
()
err
=
xerr
.
First
(
err
,
__
)
err
=
xerr
.
First
(
err
,
__
)
}()
}()
defer
func
()
{
__
:=
stor
.
back
.
Close
()
err
=
xerr
.
First
(
err
,
__
)
}()
// connect to master and let it drive us via commands and updates
// connect to master and let it drive us via commands and updates
return
stor
.
node
.
TalkMaster
(
ctx
,
func
(
ctx
context
.
Context
,
mlink
*
_MasterLink
)
error
{
return
stor
.
node
.
TalkMaster
(
ctx
,
func
(
ctx
context
.
Context
,
mlink
*
_MasterLink
)
error
{
//
XXX
move -> SetNumReplicas handler
//
TODO
move -> SetNumReplicas handler
// // NumReplicas: neo/py meaning for n(replica) = `n(real-replica) - 1`
// // NumReplicas: neo/py meaning for n(replica) = `n(real-replica) - 1`
// if !(accept.NumPartitions == 1 && accept.NumReplicas == 0) {
// if !(accept.NumPartitions == 1 && accept.NumReplicas == 0) {
// return fmt.Errorf("TODO for 1-storage POC: Npt: %d Nreplica: %d", accept.NumPartitions, accept.NumReplicas)
// return fmt.Errorf("TODO for 1-storage POC: Npt: %d Nreplica: %d", accept.NumPartitions, accept.NumReplicas)
...
@@ -175,7 +175,7 @@ func (stor *Storage) m1initialize1(ctx context.Context, req neonet.Request) erro
...
@@ -175,7 +175,7 @@ func (stor *Storage) m1initialize1(ctx context.Context, req neonet.Request) erro
RowList
:
stor
.
node
.
State
.
PartTab
.
Dump
()})
RowList
:
stor
.
node
.
State
.
PartTab
.
Dump
()})
case
*
proto
.
LockedTransactions
:
case
*
proto
.
LockedTransactions
:
//
XXX
r/o stub
//
FIXME
r/o stub
err
=
req
.
Reply
(
&
proto
.
AnswerLockedTransactions
{})
err
=
req
.
Reply
(
&
proto
.
AnswerLockedTransactions
{})
// TODO AskUnfinishedTransactions
// TODO AskUnfinishedTransactions
...
@@ -363,7 +363,7 @@ func (stor *Storage) serveLink(ctx context.Context, req *neonet.Request, idReq *
...
@@ -363,7 +363,7 @@ func (stor *Storage) serveLink(ctx context.Context, req *neonet.Request, idReq *
// TODO -> do what go-fuse does:
// TODO -> do what go-fuse does:
// - serve request in the goroutine that received it (reduces latency)
// - serve request in the goroutine that received it (reduces latency)
// - spawn another goroutine to continue accept loop
// - spawn another goroutine to continue accept loop
// - limit number of such accept-loop goroutines by GOMAXPROC
// - limit number of such accept-loop goroutines by GOMAXPROC
S
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
stor
.
serveClient
(
ctx
,
req
)
return
stor
.
serveClient
(
ctx
,
req
)
})
})
...
...
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